1221. condition_variable wording

Section: 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 a condition_variable object while the corresponding predicate is false 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 a condition_variable object while the corresponding predicate is false is likely to lead to undefined behavior. The user must take care to ensure that no threads wait on *this once the destructor has been started, especially when the waiting threads are calling the wait functions in a loop or using the overloads of wait, wait_for or wait_until that take a predicate.end note]