mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue #13817: After fork(), reinit the ad-hoc TLS implementation earlier to fix
a random deadlock when fork() is called in a multithreaded process in debug mode, and make PyOS_AfterFork() more robust.
This commit is contained in:
parent
03c29f90c3
commit
6d0d24e359
2 changed files with 26 additions and 1 deletions
|
@ -991,11 +991,13 @@ void
|
|||
PyOS_AfterFork(void)
|
||||
{
|
||||
#ifdef WITH_THREAD
|
||||
/* PyThread_ReInitTLS() must be called early, to make sure that the TLS API
|
||||
* can be called safely. */
|
||||
PyThread_ReInitTLS();
|
||||
_PyGILState_Reinit();
|
||||
PyEval_ReInitThreads();
|
||||
main_thread = PyThread_get_thread_ident();
|
||||
main_pid = getpid();
|
||||
_PyImport_ReInitLock();
|
||||
PyThread_ReInitTLS();
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue