From 87a1ad2d637e959574305db769913dd41dafee8d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 6 Aug 2024 13:15:20 +1000 Subject: [PATCH] AP_HAL: fixed CondMutex test --- libraries/AP_HAL/examples/CondMutex/CondMutex.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libraries/AP_HAL/examples/CondMutex/CondMutex.cpp b/libraries/AP_HAL/examples/CondMutex/CondMutex.cpp index 8f08949c444b2..174f254e0ba6b 100644 --- a/libraries/AP_HAL/examples/CondMutex/CondMutex.cpp +++ b/libraries/AP_HAL/examples/CondMutex/CondMutex.cpp @@ -60,10 +60,12 @@ void ProducerConsumerTest::thread2(void) } cmtx.unlock(); #else - bool ok = sem1.wait(50000); - update(ok); + sem1.wait_blocking(); + while (bsize>0) { + update(true); + } #endif - hal.scheduler->delay_microseconds(get_random()); + hal.scheduler->delay_microseconds(get_random()+1); } } @@ -78,7 +80,7 @@ void ProducerConsumerTest::thread1(void) sem1.signal(); update_sent(); #endif - hal.scheduler->delay_microseconds(get_random()); + hal.scheduler->delay_microseconds(get_random()+1); } }