From: Charles-François Natali Date: Thu, 2 Feb 2012 19:32:48 +0000 (+0100) Subject: Issue #13817: After fork(), reinit the ad-hoc TLS implementation earlier to fix X-Git-Tag: v3.3.0a1~264^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=19c6bf8f8393352f6a3f94bfbb91229a1cb6280b;p=python 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. --- 19c6bf8f8393352f6a3f94bfbb91229a1cb6280b diff --cc Modules/signalmodule.c index c28f7afab0,32cd8bbece..e46f8cf1dc --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@@ -1408,28 -999,5 +1411,27 @@@ PyOS_AfterFork(void main_thread = PyThread_get_thread_ident(); main_pid = getpid(); _PyImport_ReInitLock(); - PyThread_ReInitTLS(); #endif } + +int +_PyOS_IsMainThread(void) +{ +#ifdef WITH_THREAD + return PyThread_get_thread_ident() == main_thread; +#else + return 1; +#endif +} + +#ifdef MS_WINDOWS +void *_PyOS_SigintEvent(void) +{ + /* Returns a manual-reset event which gets tripped whenever + SIGINT is received. + + Python.h does not include windows.h so we do cannot use HANDLE + as the return type of this function. We use void* instead. */ + return sigint_event; +} +#endif