From 362ee33d32fb12c45010756e45c028f5d94780c5 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 2 May 2019 17:44:27 +0200 Subject: [PATCH] tests: hopefully make notify_all() test more robust --- tests/pipeline/test_condition_var.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/pipeline/test_condition_var.py b/tests/pipeline/test_condition_var.py index 6aa8bcf320..3458d1c9b6 100644 --- a/tests/pipeline/test_condition_var.py +++ b/tests/pipeline/test_condition_var.py @@ -123,12 +123,16 @@ def test_cvar_notify_all_threads(num_threads): break assert state['waiting'] == num_threads - m.release() # OK, now signal it, and yield. All threads must unblock. cv.notify_all() - yield_thread() - m.acquire() + for i in range(1000): + m.release() + yield_thread() + m.acquire() + if state['waiting'] == 0: + break + assert state['waiting'] == 0 m.release()