mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 08:44:19 -04:00
tests: hopefully fix sporadic test failures with condition var test
This commit is contained in:
parent
226d888ef4
commit
bf302a0838
@ -72,16 +72,22 @@ def test_cvar_notify_thread(num_threads):
|
|||||||
break
|
break
|
||||||
|
|
||||||
assert state['waiting'] == num_threads
|
assert state['waiting'] == num_threads
|
||||||
m.release()
|
|
||||||
|
|
||||||
# OK, now signal it, and yield. One thread must be unblocked per notify.
|
# OK, now signal it, and yield. One thread must be unblocked per notify.
|
||||||
for i in range(num_threads):
|
for i in range(num_threads):
|
||||||
cv.notify()
|
cv.notify()
|
||||||
|
expected_waiters = num_threads - i - 1
|
||||||
|
|
||||||
|
for j in range(1000):
|
||||||
|
m.release()
|
||||||
yield_thread()
|
yield_thread()
|
||||||
m.acquire()
|
m.acquire()
|
||||||
assert state['waiting'] == num_threads - i - 1
|
if state['waiting'] == expected_waiters:
|
||||||
m.release()
|
break
|
||||||
|
|
||||||
|
assert state['waiting'] == expected_waiters
|
||||||
|
|
||||||
|
m.release()
|
||||||
for thread in threads:
|
for thread in threads:
|
||||||
thread.join()
|
thread.join()
|
||||||
cv = None
|
cv = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user