diff options
| author | Charles-François Natali <neologix@free.fr> | 2012-02-02 19:36:47 (GMT) |
|---|---|---|
| committer | Charles-François Natali <neologix@free.fr> | 2012-02-02 19:36:47 (GMT) |
| commit | 6dce7d633fdb33f0241cf7105b7b84537c9069a8 (patch) | |
| tree | e4de1addcc8e47d90d7777092370bf8f3b32b839 /Lib/test | |
| parent | fe6f9d0edc8dc6dd7e51317c8f9788fdd5eeff50 (diff) | |
| parent | e0e88b0483d73c925e8f1809d24031acd6bfdf01 (diff) | |
| download | cpython-6dce7d633fdb33f0241cf7105b7b84537c9069a8.zip cpython-6dce7d633fdb33f0241cf7105b7b84537c9069a8.tar.gz cpython-6dce7d633fdb33f0241cf7105b7b84537c9069a8.tar.bz2 | |
Merge.
Diffstat (limited to 'Lib/test')
| -rw-r--r-- | Lib/test/test_threading.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index bdb7f14..e617fa1 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -635,6 +635,29 @@ class ThreadJoinOnShutdown(BaseTestCase): output = "end of worker thread\nend of main thread\n" self.assertScriptHasOutput(script, output) + @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + def test_reinit_tls_after_fork(self): + # Issue #13817: fork() would deadlock in a multithreaded program with + # the ad-hoc TLS implementation. + + def do_fork_and_wait(): + # just fork a child process and wait it + pid = os.fork() + if pid > 0: + os.waitpid(pid, 0) + else: + os._exit(0) + + # start a bunch of threads that will fork() child processes + threads = [] + for i in range(16): + t = threading.Thread(target=do_fork_and_wait) + threads.append(t) + t.start() + + for t in threads: + t.join() + class ThreadingExceptionTests(BaseTestCase): # A RuntimeError should be raised if Thread.start() is called |
