gcc/libstdc++-v3/testsuite/30_threads
Alexandre Oliva 16554ba1fe libstdc++: testsuite: async.cc early timeout
The async call and future variable initialization may take a while to
complete on uniprocessors, especially if the async call and other
unrelated processes run before context switches back to the main
thread.

Taking steady_begin only then sometimes causes the 11*100ms in the
slow clock, counted from before the async call, to not be enough for
the measured wait to last 1s in the steady clock.  I've seen it fall
short of 1s by as little as a third of a tenth of a second in some
cases, but in one surprisingly extreme case the elapsed wait time got
only up to 216.7ms.

Initializing both timestamps next to each other, before the async
call, appears to avoid the problem entirely.  I've renamed the
variable moved out of the block so as to avoid name hiding in the
subsequent block, that has another steady_begin variable.

The second wait fails a lot less frequently, but the 2s limit has been
exceeded, so I'm bumping up the max sleep to ~4s, and the tolerance to
3s.


for  libstdc++-v3/ChangeLog

	* testsuite/30_threads/async/async.cc (test04): Initialize
	steady_start, renamed from steady_begin, next to slow_start.
	Increase tolerance for final wait.
2023-03-03 17:00:53 -03:00
..
async libstdc++: testsuite: async.cc early timeout 2023-03-03 17:00:53 -03:00
barrier Update copyright years. 2023-01-16 11:52:17 +01:00
call_once Update copyright years. 2023-01-16 11:52:17 +01:00
condition_variable Update copyright years. 2023-01-16 11:52:17 +01:00
condition_variable_any Update copyright years. 2023-01-16 11:52:17 +01:00
future Update copyright years. 2023-01-16 11:52:17 +01:00
headers Update copyright years. 2023-01-16 11:52:17 +01:00
jthread Update copyright years. 2023-01-16 11:52:17 +01:00
latch Update copyright years. 2023-01-16 11:52:17 +01:00
lock Update copyright years. 2023-01-16 11:52:17 +01:00
lock_guard Update copyright years. 2023-01-16 11:52:17 +01:00
mutex Update copyright years. 2023-01-16 11:52:17 +01:00
packaged_task Update copyright years. 2023-01-16 11:52:17 +01:00
promise Update copyright years. 2023-01-16 11:52:17 +01:00
recursive_mutex Update copyright years. 2023-01-16 11:52:17 +01:00
recursive_timed_mutex Update copyright years. 2023-01-16 11:52:17 +01:00
scoped_lock Update copyright years. 2023-01-16 11:52:17 +01:00
semaphore Update copyright years. 2023-01-16 11:52:17 +01:00
shared_future Update copyright years. 2023-01-16 11:52:17 +01:00
shared_lock Update copyright years. 2023-01-16 11:52:17 +01:00
shared_mutex Update copyright years. 2023-01-16 11:52:17 +01:00
shared_timed_mutex Update copyright years. 2023-01-16 11:52:17 +01:00
stop_token Update copyright years. 2023-01-16 11:52:17 +01:00
this_thread Update copyright years. 2023-01-16 11:52:17 +01:00
thread Update copyright years. 2023-01-16 11:52:17 +01:00
timed_mutex Update copyright years. 2023-01-16 11:52:17 +01:00
try_lock Update copyright years. 2023-01-16 11:52:17 +01:00
unique_lock Update copyright years. 2023-01-16 11:52:17 +01:00