Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions Lib/test/_test_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1694,18 +1694,19 @@ def test_notify_all(self):
woken = self.Semaphore(0)

# start some threads/processes which will timeout
workers = []
for i in range(3):
p = self.Process(target=self.f,
args=(cond, sleeping, woken, TIMEOUT1))
p.daemon = True
p.start()
self.addCleanup(p.join)
workers.append(p)

t = threading.Thread(target=self.f,
args=(cond, sleeping, woken, TIMEOUT1))
t.daemon = True
t.start()
self.addCleanup(t.join)
workers.append(t)

# wait for them all to sleep
for i in range(6):
Expand All @@ -1724,12 +1725,12 @@ def test_notify_all(self):
p = self.Process(target=self.f, args=(cond, sleeping, woken))
p.daemon = True
p.start()
self.addCleanup(p.join)
workers.append(p)

t = threading.Thread(target=self.f, args=(cond, sleeping, woken))
t.daemon = True
t.start()
self.addCleanup(t.join)
workers.append(t)

# wait for them to all sleep
for i in range(6):
Expand All @@ -1745,11 +1746,17 @@ def test_notify_all(self):
cond.release()

# check they have all woken
self.assertReachesEventually(lambda: get_value(woken), 6)
for i in range(6):
woken.acquire()
self.assertReturnsIfImplemented(0, get_value, woken)

# check state is not mucked up
self.check_invariant(cond)

for w in workers:
# NOTE: join_process and join_thread are the same
threading_helper.join_thread(w)

def test_notify_n(self):
cond = self.Condition()
sleeping = self.Semaphore(0)
Expand Down
Loading