You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this case, in wait_until, _Abs_time - _Clock::now() will result in a large unsigned value. A quick fix would be adding a comparison before calling wait_for (return at once if _Abs_time <= now).
In the current implementation, there are both wait_until calling wait_for(see below) and wait_for calling wait_until(example). For better consistency and conformance to the standard(ref), a thorough fix would be ensuring that every wait_for will call a matching wait_until.
static_assert(chrono::is_clock_v<_Clock>, "Clock type required");
#endif // _HAS_CXX20
return wait_for(_Lck, _Abs_time - _Clock::now());
}
The text was updated successfully, but these errors were encountered:
achabense
changed the title
<condition_variable>: condition_variable_any::wait_for should be defined based on wait_untilcondition_variable_any::wait_for should be defined using wait_untilJun 9, 2023
achabense
changed the title
condition_variable_any::wait_for should be defined using wait_until<condition_variable>: condition_variable_any::wait_until may result in infinite wait unexpectedly
Jun 9, 2023
achabense
changed the title
<condition_variable>: condition_variable_any::wait_until may result in infinite wait unexpectedly<condition_variable>: condition_variable_any::wait_until may cause infinite wait
Jun 9, 2023
The following code will cause infinite wait (unexpectedly).
In this case, in
wait_until
,_Abs_time - _Clock::now()
will result in a large unsigned value. A quick fix would be adding a comparison before callingwait_for
(return at once if_Abs_time <= now
).In the current implementation, there are both
wait_until
callingwait_for
(see below) andwait_for
callingwait_until
(example). For better consistency and conformance to the standard(ref), a thorough fix would be ensuring that everywait_for
will call a matchingwait_until
.STL/stl/inc/condition_variable
Lines 92 to 99 in c8d1efb
The text was updated successfully, but these errors were encountered: