1 parent eeb9efd commit 77df1a6Copy full SHA for 77df1a6
1 file changed
test/event_test.cpp
@@ -492,7 +492,14 @@ TEMPLATE_TEST_CASE( "auto_reset_event implementations",
492
// Signal n times — each signal should wake exactly one thread.
493
for ( unsigned i = 0; i < n; ++i ) {
494
ev.signal();
495
- std::this_thread::sleep_for( 5ms );
+ // Spin-wait for the woken thread to increment the counter.
496
+ // A fixed sleep is insufficient on loaded CI runners.
497
+ auto deadline = std::chrono::steady_clock::now() + 2s;
498
+ while ( woken.load( std::memory_order_acquire ) != int( i + 1 ) ) {
499
+ if ( std::chrono::steady_clock::now() > deadline )
500
+ break;
501
+ std::this_thread::sleep_for( 1ms );
502
+ }
503
REQUIRE( woken.load() == int( i + 1 ) );
504
}
505
0 commit comments