condition_variable wordingSection: 32.7.4 [thread.condition.condvar] Status: C++11 Submitter: Jeffrey Yasskin Opened: 2009-09-30 Last modified: 2016-01-28
Priority: Not Prioritized
View other active issues in [thread.condition.condvar].
View all other issues in [thread.condition.condvar].
View all issues with C++11 status.
Discussion:
32.7.4 [thread.condition.condvar] says:
~condition_variable();Precondition: There shall be no thread blocked on
*this. [Note: That is, all threads shall have been notified; they may subsequently block on the lock specified in the wait. Beware that destroying acondition_variableobject while the corresponding predicate isfalseis likely to lead to undefined behavior. — end note]
The text hasn't introduced the notion of a "corresponding predicate" yet.
[ 2010-02-11 Anthony provided wording. ]
[ 2010-02-12 Moved to Tentatively Ready after 5 positive votes on c++std-lib. ]
Proposed resolution:
Modify 32.7.4 [thread.condition.condvar]p4 as follows:
~condition_variable();4 Precondition: There shall be no thread blocked on
*this. [Note: That is, all threads shall have been notified; they may subsequently block on the lock specified in the wait.Beware that destroying aThe user must take care to ensure that no threads wait oncondition_variableobject while the corresponding predicate is false is likely to lead to undefined behavior.*thisonce the destructor has been started, especially when the waiting threads are calling the wait functions in a loop or using the overloads ofwait,wait_fororwait_untilthat take a predicate. — end note]