diff options
author | Richard Oudkerk <shibturn@gmail.com> | 2013-02-26 12:37:07 +0000 |
---|---|---|
committer | Richard Oudkerk <shibturn@gmail.com> | 2013-02-26 12:37:07 +0000 |
commit | ba48264bce265a70157181dbd499f99a50ec0931 (patch) | |
tree | 32da976b02bf5be9dbc4938b5a0ce998ec8a9ee6 /Lib/test/test_multiprocessing.py | |
parent | b1bbc0b3dc870ecb7621fa7499f2347fe4a6a8e7 (diff) | |
download | cpython-git-ba48264bce265a70157181dbd499f99a50ec0931.tar.gz |
Issue #17018: Make Process.join() retry if os.waitpid() fails with EINTR.
Diffstat (limited to 'Lib/test/test_multiprocessing.py')
-rw-r--r-- | Lib/test/test_multiprocessing.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py index f140aca63f..9b3f0a9647 100644 --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -2105,6 +2105,38 @@ class _TestLogging(BaseTestCase): # assert self.__handled # +# Check that Process.join() retries if os.waitpid() fails with EINTR +# + +class _TestPollEintr(BaseTestCase): + + ALLOWED_TYPES = ('processes',) + + @classmethod + def _killer(cls, pid): + time.sleep(0.5) + os.kill(pid, signal.SIGUSR1) + + @unittest.skipUnless(hasattr(signal, 'SIGUSR1'), 'requires SIGUSR1') + def test_poll_eintr(self): + got_signal = [False] + def record(*args): + got_signal[0] = True + pid = os.getpid() + oldhandler = signal.signal(signal.SIGUSR1, record) + try: + killer = self.Process(target=self._killer, args=(pid,)) + killer.start() + p = self.Process(target=time.sleep, args=(1,)) + p.start() + p.join() + self.assertTrue(got_signal[0]) + self.assertEqual(p.exitcode, 0) + killer.join() + finally: + signal.signal(signal.SIGUSR1, oldhandler) + +# # Test to verify handle verification, see issue 3321 # |