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

3425. condition_variable_any fails to constrain its Lock parameters

Section: 33.7.5 [thread.condition.condvarany] Status: WP Submitter: Casey Carter Opened: 2020-04-04 Last modified: 2020-11-09

Priority: 0

View all other issues in [thread.condition.condvarany].

View all issues with WP status.

Discussion:

33.7.5 [thread.condition.condvarany]/1 says "A Lock type shall meet the Cpp17BasicLockable requirements (33.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.

Previous resolution [SUPERSEDED]:

This wording is relative to N4861.

  1. Modify 33.7.5 [thread.condition.condvarany] as indicated:

    -1- A Lock typeTemplate arguments for template parameters of member templates of conditional_variable_any named Lock shall meet the Cpp17BasicLockable requirements (33.2.5.2 [thread.req.lockable.basic]). [Note: All of the standard mutex types meet this requirement. If a Lock type other than one of the standard mutex types or a unique_lock wrapper for a standard mutex type is used with condition_variable_any, the user should ensure that any necessary synchronization is in place with respect to the predicate associated with the condition_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.

  1. Modify 33.7.5 [thread.condition.condvarany] as indicated:

    -1- A Lock typeIn this subclause 33.7.5 [thread.condition.condvarany], template arguments for template parameters named Lock shall meet the Cpp17BasicLockable requirements (33.2.5.2 [thread.req.lockable.basic]). [Note: All of the standard mutex types meet this requirement. If a Lock type other than one of the standard mutex types or a unique_lock wrapper for a standard mutex type is used with condition_variable_any, the user should ensure that any necessary synchronization is in place with respect to the predicate associated with the condition_variable_any instance. — end note]