mirror of git://gcc.gnu.org/git/gcc.git
![]() 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. |
||
---|---|---|
.. | ||
async | ||
barrier | ||
call_once | ||
condition_variable | ||
condition_variable_any | ||
future | ||
headers | ||
jthread | ||
latch | ||
lock | ||
lock_guard | ||
mutex | ||
packaged_task | ||
promise | ||
recursive_mutex | ||
recursive_timed_mutex | ||
scoped_lock | ||
semaphore | ||
shared_future | ||
shared_lock | ||
shared_mutex | ||
shared_timed_mutex | ||
stop_token | ||
this_thread | ||
thread | ||
timed_mutex | ||
try_lock | ||
unique_lock |