]> granicus.if.org Git - python/commitdiff
Issue #13817: After fork(), reinit the ad-hoc TLS implementation earlier to fix
authorCharles-François Natali <neologix@free.fr>
Thu, 2 Feb 2012 19:32:48 +0000 (20:32 +0100)
committerCharles-François Natali <neologix@free.fr>
Thu, 2 Feb 2012 19:32:48 +0000 (20:32 +0100)
a random deadlock when fork() is called in a multithreaded process in debug
mode, and make PyOS_AfterFork() more robust.

1  2 
Lib/test/test_threading.py
Modules/signalmodule.c

Simple merge
index c28f7afab030bbe9610e9f0ab55f30d3cf58d94b,32cd8bbece1fe0399e984e0841a87ce0d5b75c73..e46f8cf1dcf895716b07e6bcdada605ae0dfc886
@@@ -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