Skip to content

Commit bf302a0

Browse files
committed
tests: hopefully fix sporadic test failures with condition var test
1 parent 226d888 commit bf302a0

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

tests/pipeline/test_condition_var.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,22 @@ def wait_thread():
7272
break
7373

7474
assert state['waiting'] == num_threads
75-
m.release()
7675

7776
# OK, now signal it, and yield. One thread must be unblocked per notify.
7877
for i in range(num_threads):
7978
cv.notify()
80-
yield_thread()
81-
m.acquire()
82-
assert state['waiting'] == num_threads - i - 1
83-
m.release()
79+
expected_waiters = num_threads - i - 1
8480

81+
for j in range(1000):
82+
m.release()
83+
yield_thread()
84+
m.acquire()
85+
if state['waiting'] == expected_waiters:
86+
break
87+
88+
assert state['waiting'] == expected_waiters
89+
90+
m.release()
8591
for thread in threads:
8692
thread.join()
8793
cv = None

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy