mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +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
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue