This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++23 status.
condition_variable_any
fails to constrain its Lock
parametersSection: 32.7.5 [thread.condition.condvarany] Status: C++23 Submitter: Casey Carter Opened: 2020-04-04 Last modified: 2023-11-22
Priority: 0
View all other issues in [thread.condition.condvarany].
View all issues with C++23 status.
Discussion:
32.7.5 [thread.condition.condvarany]/1 says "A Lock
type shall meet the Cpp17BasicLockable
requirements (32.2.5.2 [thread.req.lockable.basic]).", which is fine, but it notably doesn't require anything
to be a Lock
type or meet the requirements of a Lock
type. Given that every member template of
condition_variable_any
has a template parameter named Lock
, the intent is clearly to impose a
requirement on the template arguments supplied for those parameters but the use of code font for "Lock
"
in the definition of "Lock
type" is a bit subtle to establish that connection. We should specify this
more clearly.
This wording is relative to N4861.
Modify 32.7.5 [thread.condition.condvarany] as indicated:
-1-
ATemplate arguments for template parameters of member templates ofLock
typeconditional_variable_any
namedLock
shall meet the Cpp17BasicLockable requirements (32.2.5.2 [thread.req.lockable.basic]). [Note: All of the standard mutex types meet this requirement. If atype other than one of the standard mutex types or aLock
unique_lock
wrapper for a standard mutex type is used withcondition_variable_any
, the user should ensure that any necessary synchronization is in place with respect to the predicate associated with thecondition_variable_any
instance. — end note]
[2020-04-06; Tim improves wording]
[2020-04-11 Issue Prioritization]
Status set to Tentatively Ready after seven positive votes on the reflector.
[2020-11-09 Approved In November virtual meeting. Status changed: Tentatively Ready → WP.]
Proposed resolution:
This wording is relative to N4861.
Modify 32.7.5 [thread.condition.condvarany] as indicated:
-1-
AIn this subclause 32.7.5 [thread.condition.condvarany], template arguments for template parameters namedLock
typeLock
shall meet the Cpp17BasicLockable requirements (32.2.5.2 [thread.req.lockable.basic]). [Note: All of the standard mutex types meet this requirement. If atype other than one of the standard mutex types or aLock
unique_lock
wrapper for a standard mutex type is used withcondition_variable_any
, the user should ensure that any necessary synchronization is in place with respect to the predicate associated with thecondition_variable_any
instance. — end note]