mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
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.
This commit is contained in:
parent
1b9530c536
commit
f82c951d1c
2 changed files with 5 additions and 0 deletions
|
@ -556,6 +556,7 @@ Eric Groo
|
||||||
Daniel Andrade Groppe
|
Daniel Andrade Groppe
|
||||||
Dag Gruneau
|
Dag Gruneau
|
||||||
Filip Gruszczyński
|
Filip Gruszczyński
|
||||||
|
Andrii Grynenko
|
||||||
Grzegorz Grzywacz
|
Grzegorz Grzywacz
|
||||||
Thomas Guettler
|
Thomas Guettler
|
||||||
Yuyang Guo
|
Yuyang Guo
|
||||||
|
|
|
@ -744,6 +744,10 @@ _PyGILState_Fini(void)
|
||||||
void
|
void
|
||||||
_PyGILState_Reinit(void)
|
_PyGILState_Reinit(void)
|
||||||
{
|
{
|
||||||
|
#ifdef WITH_THREAD
|
||||||
|
head_mutex = NULL;
|
||||||
|
HEAD_INIT();
|
||||||
|
#endif
|
||||||
PyThreadState *tstate = PyGILState_GetThisThreadState();
|
PyThreadState *tstate = PyGILState_GetThisThreadState();
|
||||||
PyThread_delete_key(autoTLSkey);
|
PyThread_delete_key(autoTLSkey);
|
||||||
if ((autoTLSkey = PyThread_create_key()) == -1)
|
if ((autoTLSkey = PyThread_create_key()) == -1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue