condition_variable_any::wait_for
Section: 32.7.5 [thread.condition.condvarany] Status: C++11 Submitter: Anthony Williams Opened: 2009-11-17 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [thread.condition.condvarany].
View all issues with C++11 status.
Discussion:
32.7.5 [thread.condition.condvarany]p18 and 32.7.5 [thread.condition.condvarany]p27 specify incorrect preconditions for
condition_variable_any::wait_for
. The stated preconditions require that
lock
has a mutex()
member function, and that this produces the
same result for all concurrent calls to wait_for()
. This is
inconsistent with wait()
and wait_until()
which do not impose
such a requirement.
[ 2009-12-24 Moved to Tentatively Ready after 5 positive votes on c++std-lib. ]
Proposed resolution:
Remove 32.7.5 [thread.condition.condvarany]p18 and 32.7.5 [thread.condition.condvarany]p27.
template <class Lock, class Rep, class Period> cv_status wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time);
18 Precondition: lock is locked by the calling thread, and either
no other thread is waiting on thiscondition_variable
object orlock.mutex()
returns the same value for each of the lock arguments supplied by all concurrently waiting (viawait
,wait_for
, orwait_until
) threads....
template <class Lock, class Rep, class Period, class Predicate> bool wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time, Predicate pred);
27 Precondition: lock is locked by the calling thread, and either
no other thread is waiting on thiscondition_variable
object orlock.mutex()
returns the same value for each of the lock arguments supplied by all concurrently waiting (viawait
,wait_for
, orwait_until
) threads.