mirror of
https://github.com/python/cpython.git
synced 2025-09-30 04:15:43 +00:00
[3.6] bpo-30395 _PyGILState_Reinit deadlock fix (GH-1734) (#1740)
head_lock could be held by another thread when fork happened. We should
reset it to avoid deadlock.
(cherry picked from commit f82c951d1c
)
This commit is contained in:
parent
1398b1bc7d
commit
d29feccec3
2 changed files with 5 additions and 0 deletions
|
@ -552,6 +552,7 @@ Eric Groo
|
|||
Daniel Andrade Groppe
|
||||
Dag Gruneau
|
||||
Filip Gruszczyński
|
||||
Andrii Grynenko
|
||||
Grzegorz Grzywacz
|
||||
Thomas Guettler
|
||||
Yuyang Guo
|
||||
|
|
|
@ -743,6 +743,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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue