diff options
author | Charles-François Natali <neologix@free.fr> | 2012-02-02 18:57:19 (GMT) |
---|---|---|
committer | Charles-François Natali <neologix@free.fr> | 2012-02-02 18:57:19 (GMT) |
commit | e0e88b0483d73c925e8f1809d24031acd6bfdf01 (patch) | |
tree | 97a5539362d668c1ee9f9a0e1dacd20d3786f54d /Modules | |
parent | da6db4f8b0fd3de3a5adc6b8f856e80bfda0d40a (diff) | |
download | cpython-e0e88b0483d73c925e8f1809d24031acd6bfdf01.zip cpython-e0e88b0483d73c925e8f1809d24031acd6bfdf01.tar.gz cpython-e0e88b0483d73c925e8f1809d24031acd6bfdf01.tar.bz2 |
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.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/signalmodule.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index f306bba..908c2ee 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -976,10 +976,12 @@ 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(); PyEval_ReInitThreads(); main_thread = PyThread_get_thread_ident(); main_pid = getpid(); _PyImport_ReInitLock(); - PyThread_ReInitTLS(); #endif } |