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.
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 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_variable
object while the corresponding predicate isfalse
is 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_variable
object while the corresponding predicate is false is likely to lead to undefined behavior.*this
once the destructor has been started, especially when the waiting threads are calling the wait functions in a loop or using the overloads ofwait
,wait_for
orwait_until
that take a predicate. — end note]