diff --git a/TESTS/mbed_drivers/timeout/timeout_tests.h b/TESTS/mbed_drivers/timeout/timeout_tests.h index 89ab92b4ce..fd71cb6a1b 100644 --- a/TESTS/mbed_drivers/timeout/timeout_tests.h +++ b/TESTS/mbed_drivers/timeout/timeout_tests.h @@ -196,13 +196,14 @@ void test_multiple(void) template void test_no_wait(void) { - Semaphore sem(0, 1); - T timeout; - timeout.attach_callback(mbed::callback(sem_callback, &sem), 0ULL); - - bool acquired = sem.try_acquire(); - TEST_ASSERT_TRUE(acquired); - timeout.detach(); + for (int i = 0; i < 100; i++) { + Semaphore sem(0, 1); + T timeout; + timeout.attach_callback(mbed::callback(sem_callback, &sem), 0ULL); + int32_t sem_slots = sem.wait(0); + TEST_ASSERT_EQUAL(1, sem_slots); + timeout.detach(); + } } /** Template for tests: accuracy of timeout delay