summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorJason Fried <me@jasonfried.info>2017-05-22 23:58:55 (GMT)
committerƁukasz Langa <lukasz@langa.pl>2017-05-22 23:58:55 (GMT)
commitf82c951d1c5416f3550d544e50ff5662d3836e73 (patch)
tree3eece5da20e79b1c3376d0186dda931a9951c515 /Python
parent1b9530c536664276ce866ae602ce04adce0810e1 (diff)
downloadcpython-f82c951d1c5416f3550d544e50ff5662d3836e73.zip
cpython-f82c951d1c5416f3550d544e50ff5662d3836e73.tar.gz
cpython-f82c951d1c5416f3550d544e50ff5662d3836e73.tar.bz2
bpo-30395 _PyGILState_Reinit deadlock fix (#1734)
head_lock could be held by another thread when fork happened. We should reset it to avoid deadlock.
Diffstat (limited to 'Python')
-rw-r--r--Python/pystate.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index 8e81707..52899f1 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -744,6 +744,10 @@ _PyGILState_Fini(void)
void
_PyGILState_Reinit(void)
{
+#ifdef WITH_THREAD
+ head_mutex = NULL;
+ HEAD_INIT();
+#endif
PyThreadState *tstate = PyGILState_GetThisThreadState();
PyThread_delete_key(autoTLSkey);
if ((autoTLSkey = PyThread_create_key()) == -1)