Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tests/std/include/test_atomic_wait.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ void test_atomic_wait_func(const UnderlyingType old_value, const UnderlyingType
add_seq('4');
a.store(new_value);
a.notify_one();
#ifdef CAN_FAIL_ON_TIMING_ASSUMPTION
// timing assumption that the main thread evaluates the `wait(old_value)` before this timeout expires
std::this_thread::sleep_for(waiting_duration);
add_seq('6');
#endif // CAN_FAIL_ON_TIMING_ASSUMPTION
});

a.wait(old_value);
Expand All @@ -52,7 +54,12 @@ void test_atomic_wait_func(const UnderlyingType old_value, const UnderlyingType
thd.join();

add_seq('\0');

#ifdef CAN_FAIL_ON_TIMING_ASSUMPTION
assert(strcmp(seq, "123456") == 0);
#else
assert(strcmp(seq, "12345") == 0);
#endif
}

template <class UnderlyingType>
Expand Down