Commit f82c951d authored by Jason Fried's avatar Jason Fried Committed by Łukasz Langa

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.
parent 1b9530c5
......@@ -556,6 +556,7 @@ Eric Groo
Daniel Andrade Groppe
Dag Gruneau
Filip Gruszczyński
Andrii Grynenko
Grzegorz Grzywacz
Thomas Guettler
Yuyang Guo
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment