Section: 32.2.5 [thread.req.lockable], 32.6.4 [thread.mutex.requirements] Status: New Submitter: Agustín K-ballo Bergé Opened: 2016-11-12 Last modified: 2022-11-06
Priority: 3
View all issues with New status.
Discussion:
The current draft contains 14 occurrences of a Return type: clause. That clause is not covered by 16.3.2.4 [structure.specifications] p3. This was reported as editorial request #266.
[Issues Telecon 16-Dec-2016]
Priority 3; Jonathan to provide wording.
[12-May-2020, Jonathan provides wording to correct the 13 occurrences.]
Previous resolution [SUPERSEDED]:
This wording is relative to N4681.
Modify 32.2.5.3 [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 typebool
, and have the specified semantics (m
denotes a value of typeL
).
m.try_lock()
-2- Effects: [...]
-3- Return type:bool
.-4- Returns:
true
if the lock was acquired,false
otherwise.Modify 32.2.5.4 [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 typebool
, and have the specified semantics (m
denotes a value of typeL
,rel_time
denotes a value of an instantiation ofduration
(30.5 [time.duration]), andabs_time
denotes a value of an instantiation oftime_point
(30.6 [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.Modify 32.6.4.2 [thread.mutex.requirements.mutex] as indicated:
-6- The expression
m.lock()
is well-formed, has typevoid
, 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 typebool
, 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, otherwisefalse
.-19- Synchronization: [...]
-20- Throws: Nothing.
-21- The expression
m.unlock()
is well-formed, has typevoid
, and has the following semantics:-22- Preconditions: [...]
-23- Effects: [...]
-24- Return type:void
.-25- Synchronization: [...]
-26- Throws: Nothing.
Modify 32.6.4.3 [thread.timedmutex.requirements] as indicated:
-1- The timed mutex types are the standard library types [...]
-2- The timed mutex types meet the Cpp17TimedLockable requirements (32.2.5.4 [thread.req.lockable.timed]).
-3- The expression
m.try_lock_for(rel_time)
is well-formed, has typebool
, 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 typebool
, and has the following semantics:-11- Preconditions: [...]
-12- Effects: [...]
-13- Return type:bool
.-14- Returns:
true
if ownership was obtained, otherwisefalse
.-15- Synchronization: [...]
-16- Throws: [...]
Modify 32.6.4.4 [thread.sharedmutex.requirements] as indicated:
-1- The standard library types
shared_mutex
andshared_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 typevoid
, 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 typevoid
, 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 typebool
, 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: [...]
Modify 32.6.4.5 [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 typebool
, 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 typebool
, 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: [...]
[2022-11-06; Daniel comments and provides alternative wording]
Now that we have the new element Result: specified in 16.3.2.4 [structure.specifications], we can simply replace all occurrences of the Return type: by this element.
Proposed resolution:
This wording is relative to N4917.
Modify 32.2.5.3 [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 typeL
).
m.try_lock()
-2- Effects: [...]
-3-
Return typeResult:bool
.-4- Returns:
true
if the lock was acquired, otherwisefalse
.
Modify 32.2.5.4 [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 typeL
,rel_time
denotes a value of an instantiation ofduration
(30.5 [time.duration]), andabs_time
denotes a value of an instantiation oftime_point
(30.6 [time.point])).
m.try_lock_for(rel_time)
-2- Effects: [...]
-3-
Return typeResult:bool
.-4- Returns:
true
if the lock was acquired, otherwisefalse
.
m.try_lock_until(abs_time)
-5- Effects: [...]
-6-
Return typeResult:bool
.-7- Returns:
true
if the lock was acquired, otherwisefalse
.
Modify 32.6.4.2.1 [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, otherwisefalse
.-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.
Modify 32.6.4.3.1 [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, otherwisefalse
.-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, otherwisefalse
.-15- Throws: [...]
Modify 32.6.4.4.1 [thread.sharedmutex.requirements.general] as indicated:
-1- The standard library types
shared_mutex
andshared_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, otherwisefalse
.-23- Throws: [...]
Modify 32.6.4.5.1 [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, otherwisefalse
.-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, otherwisefalse
.-15- Throws: [...]