mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
Fix issue 10527: make multiprocessing use poll() instead of select() if available.
This commit is contained in:
commit
b4f39e85f2
3 changed files with 27 additions and 2 deletions
|
@ -2102,6 +2102,7 @@ class _TestConnection(BaseTestCase):
|
|||
self.assertTimingAlmostEqual(poll.elapsed, TIMEOUT1)
|
||||
|
||||
conn.send(None)
|
||||
time.sleep(.1)
|
||||
|
||||
self.assertEqual(poll(TIMEOUT1), True)
|
||||
self.assertTimingAlmostEqual(poll.elapsed, 0)
|
||||
|
@ -3251,6 +3252,7 @@ class TestWait(unittest.TestCase):
|
|||
from multiprocessing.connection import wait
|
||||
|
||||
expected = 3
|
||||
sorted_ = lambda l: sorted(l, key=lambda x: isinstance(x, int))
|
||||
sem = multiprocessing.Semaphore(0)
|
||||
a, b = multiprocessing.Pipe()
|
||||
p = multiprocessing.Process(target=self.signal_and_sleep,
|
||||
|
@ -3274,7 +3276,7 @@ class TestWait(unittest.TestCase):
|
|||
res = wait([a, p.sentinel, b], 20)
|
||||
delta = time.time() - start
|
||||
|
||||
self.assertEqual(res, [p.sentinel, b])
|
||||
self.assertEqual(sorted_(res), sorted_([p.sentinel, b]))
|
||||
self.assertLess(delta, 0.4)
|
||||
|
||||
b.send(None)
|
||||
|
@ -3283,7 +3285,7 @@ class TestWait(unittest.TestCase):
|
|||
res = wait([a, p.sentinel, b], 20)
|
||||
delta = time.time() - start
|
||||
|
||||
self.assertEqual(res, [a, p.sentinel, b])
|
||||
self.assertEqual(sorted_(res), sorted_([a, p.sentinel, b]))
|
||||
self.assertLess(delta, 0.4)
|
||||
|
||||
p.terminate()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue