Title
Unspecified Return type: elements
Status
new
Section
[thread.req.lockable][thread.mutex.requirements]
Submitter
Agustín K-ballo Bergé

Created on 2016-11-12.00:00:00 last changed 24 months ago

Messages

Date: 2022-11-06.16:23:07

Proposed resolution:

This wording is relative to N4917.

  1. Modify [thread.req.lockable.req] as indicated:

    -1- A type L meets the Cpp17Lockable requirements if it meets the Cpp17BasicLockable requirements and the following expressions are well-formed and have the specified semantics (m denotes a value of type L).

    m.try_lock()

    -2- Effects: [...]

    -3- Return typeResult: bool.

    -4- Returns: true if the lock was acquired, otherwise false.

  2. Modify [thread.req.lockable.timed] as indicated:

    -1- A type L meets the Cpp17TimedLockable requirements if it meets the Cpp17Lockable requirements and the following expressions are well-formed and have the specified semantics (m denotes a value of type L, rel_time denotes a value of an instantiation of duration ([time.duration]), and abs_time denotes a value of an instantiation of time_point ([time.point])).

    m.try_lock_for(rel_time)

    -2- Effects: [...]

    -3- Return typeResult: bool.

    -4- Returns: true if the lock was acquired, otherwise false.

    m.try_lock_until(abs_time)

    -5- Effects: [...]

    -6- Return typeResult: bool.

    -7- Returns: true if the lock was acquired, otherwise false.

  3. Modify [thread.mutex.requirements.mutex.general] as indicated:

    -5- The expression m.lock() is well-formed and has the following semantics:

    -6- Preconditions: [...]

    -7- Effects: [...]

    -8- Synchronization: [...]

    -9- Postconditions: [...]

    -10- Return typeResult: void.

    -11- Throws: [...]

    -12- Error conditions: [...]

    -13- The expression m.try_lock() is well-formed and has the following semantics:

    -14- Preconditions: [...]

    -15- Effects: [...]

    -16- Synchronization: [...]

    -17- Return typeResult: bool.

    -18- Returns: true if ownership was obtained, otherwise false.

    -19- Throws: Nothing.

    -20- The expression m.unlock() is well-formed and has the following semantics:

    -21- Preconditions: [...]

    -22- Effects: [...]

    -23- Return typeResult: void.

    -24- Synchronization: [...]

    -25- Throws: Nothing.

  4. Modify [thread.timedmutex.requirements.general] as indicated:

    -1- The timed mutex types are the standard library types […]

    -2- The expression m.try_lock_for(rel_time) is well-formed and has the following semantics:

    -3- Preconditions: [...]

    -4- Effects: [...]

    -5- Synchronization: [...]

    -6- Return typeResult: bool.

    -7- Returns: true if ownership was obtained, otherwise false.

    -8- Throws: [...]

    -9- The expression m.try_lock_until(abs_time) is well-formed and has the following semantics:

    -10- Preconditions: [...]

    -11- Effects: [...]

    -12- Synchronization: [...]

    -13- Return typeResult: bool.

    -14- Returns: true if ownership was obtained, otherwise false.

    -15- Throws: [...]

  5. Modify [thread.sharedmutex.requirements.general] as indicated:

    -1- The standard library types shared_mutex and shared_timed_mutex are shared mutex types. [...]

    -2- In addition to the exclusive lock ownership mode [...]

    -3- The expression m.lock_shared() is well-formed and has the following semantics:

    -4- Preconditions: [...]

    -5- Effects: [...]

    -6- Synchronization: [...]

    -7- Postconditions: [...]

    -8- Return typeResult: void.

    -9- Throws: [...]

    -10- Error conditions: [...]

    -11- The expression m.unlock_shared() is well-formed and has the following semantics:

    -12- Preconditions: [...]

    -13- Effects: [...]

    -14- Return typeResult: void.

    -15- Synchronization: [...]

    -16- Throws: [...]

    -17- The expression m.try_lock_shared() is well-formed and has the following semantics:

    -18- Preconditions: [...]

    -19- Effects: [...]

    -20- Synchronization: [...]

    -21- Return typeResult: bool.

    -22- Returns: true if the shared lock was acquired, otherwise false.

    -23- Throws: [...]

  6. Modify [thread.sharedtimedmutex.requirements.general] as indicated:

    -1- The standard library type shared_timed_mutex is a shared timed mutex type. [...]

    -2- The expression m.try_lock_shared_for(rel_time) is well-formed and has the following semantics:

    -3- Preconditions: [...]

    -4- Effects: [...]

    -5- Synchronization: [...]

    -6- Return typeResult: bool.

    -7- Returns: true if the shared lock was acquired, otherwise false.

    -8- Throws: [...]

    -9- The expression m.try_lock_shared_until(abs_time) is well-formed and has the following semantics:

    -10- Preconditions: [...]

    -11- Effects: [...]

    -12- Synchronization: [...]

    -13- Return typeResult: bool.

    -14- Returns: true if the shared lock was acquired, otherwise false.

    -15- Throws: [...]

Date: 2022-11-15.00:00:00

[ 2022-11-06; Daniel comments and provides alternative wording ]

Now that we have the new element Result: specified in [structure.specifications], we can simply replace all occurrences of the Return type: by this element.

Date: 2022-11-06.16:23:07

[ 12-May-2020, Jonathan provides wording to correct the 13 occurrences. ]

Previous resolution [SUPERSEDED]:

This wording is relative to N4681.

  1. Modify [thread.req.lockable.req] as indicated:

    -1- A type L meets the Cpp17Lockable requirements if it meets the Cpp17BasicLockable requirements and the following expressions are well-formed, have type bool, and have the specified semantics (m denotes a value of type L).

    m.try_lock()

    -2- Effects: [...]

    -3- Return type: bool.

    -4- Returns: true if the lock was acquired, false otherwise.

  2. Modify [thread.req.lockable.timed] as indicated:

    -1- A type L meets the Cpp17TimedLockable requirements if it meets the Cpp17BasicLockable requirements and the following expressions are well-formed, have type bool, and have the specified semantics (m denotes a value of type L, rel_time denotes a value of an instantiation of duration ([time.duration]), and abs_time denotes a value of an instantiation of time_point ([time.point])).

    m.try_lock_for(rel_time)

    -2- Effects: [...]

    -3- Return type: bool.

    -4- Returns: true if the lock was acquired, false otherwise.

    m.try_lock_until(abs_time)

    -2- Effects: [...]

    -3- Return type: bool.

    -4- Returns: true if the lock was acquired, false otherwise.

  3. Modify [thread.mutex.requirements.mutex] as indicated:

    -6- The expression m.lock() is well-formed, has type void, and has the following semantics:

    -7- Preconditions: [...]

    -8- Effects: [...]

    -9- Postconditions: [...]

    -10- Return type: void.

    -11- Synchronization: [...]

    -12- Throws: [...]

    -13- Error conditions: [...]

    -14- The expression m.try_lock() is well-formed, has type bool, and has the following semantics:

    -15- Preconditions: [...]

    -16- Effects: [...]

    -17- Return type: bool.

    -18- Returns: true if ownership of the mutex was obtained for the calling thread, otherwise false.

    -19- Synchronization: [...]

    -20- Throws: Nothing.

    -21- The expression m.unlock() is well-formed, has type void, and has the following semantics:

    -22- Preconditions: [...]

    -23- Effects: [...]

    -24- Return type: void.

    -25- Synchronization: [...]

    -26- Throws: Nothing.

  4. Modify [thread.timedmutex.requirements] as indicated:

    -1- The timed mutex types are the standard library types [...]

    -2- The timed mutex types meet the Cpp17TimedLockable requirements ([thread.req.lockable.timed]).

    -3- The expression m.try_lock_for(rel_time) is well-formed, has type bool, and has the following semantics:

    -4- Preconditions: [...]

    -5- Effects: [...]

    -6- Return type: bool.

    -7- Returns: true if the shared lock was acquired, false otherwise.

    -8- Synchronization: [...]

    -9- Throws: [...]

    -10- The expression m.try_lock_until(abs_time) is well-formed, has type bool, and has the following semantics:

    -11- Preconditions: [...]

    -12- Effects: [...]

    -13- Return type: bool.

    -14- Returns: true if ownership was obtained, otherwise false.

    -15- Synchronization: [...]

    -16- Throws: [...]

  5. Modify [thread.sharedmutex.requirements] as indicated:

    -1- The standard library types shared_mutex and shared_timed_mutex are shared mutex types. [...]

    -2- In addition to the exclusive lock ownership mode [...]

    -3- The expression m.lock_shared() is well-formed, has type void, and has the following semantics:

    -4- Preconditions: [...]

    -5- Effects: [...]

    -6- Postconditions: [...]

    -7- Return type: void.

    -8- Synchronization: [...]

    -9- Throws: [...]

    -10- Error conditions: [...]

    -11- The expression m.unlock_shared() is well-formed, has type void, and has the following semantics:

    -12- Preconditions: [...]

    -13- Effects: [...]

    -14- Return type: void.

    -15- Synchronization: [...]

    -16- Throws: [...]

    -17- The expression m.try_lock_shared() is well-formed, has type bool, and has the following semantics:

    -18- Preconditions: [...]

    -19- Effects: [...]

    -20- Return type: bool.

    -21- Returns: true if the shared ownership lock was acquired, false otherwise.

    -22- Synchronization: [...]

    -23- Throws: [...]

  6. Modify [thread.sharedtimedmutex.requirements] as indicated:

    -1- The standard library type shared_timed_mutex is a shared timed mutex type. [...]

    -2- The expression m.try_lock_shared_for(rel_time) is well-formed, has type bool, and has the following semantics:

    -3- Preconditions: [...]

    -4- Effects: [...]

    -5- Return type: bool.

    -6- Returns: true if the shared lock was acquired, false otherwise.

    -7- Synchronization: [...]

    -8- Throws: [...]

    -9- The expression m.try_lock_shared_until(abs_time) is well-formed, has type bool, and has the following semantics:

    -10- Preconditions: [...]

    -11- Effects: [...]

    -12- Return type: bool.

    -13- Returns: true if the shared lock was acquired, false otherwise.

    -14- Synchronization: [...]

    -15- Throws: [...]

Date: 2017-02-02.00:41:18

[ Issues Telecon 16-Dec-2016 ]

Priority 3; Jonathan to provide wording.

Date: 2016-11-12.00:00:00

The current draft contains 14 occurrences of a Return type: clause. That clause is not covered by [structure.specifications] p3. This was reported as editorial request #266.

History
Date User Action Args
2022-11-06 16:23:07adminsetmessages: + msg12940
2020-05-12 20:44:32adminsetmessages: + msg11295
2020-05-12 20:44:32adminsetmessages: + msg11294
2016-12-16 20:56:38adminsetmessages: + msg8749
2016-11-12 00:00:00admincreate