This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.

1267. Incorrect wording for condition_variable_any::wait_for

Section: 33.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:

33.7.5 [thread.condition.condvarany]p18 and 33.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 33.7.5 [thread.condition.condvarany]p18 and 33.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

...

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