33
Concurrency support library
[thread]
33.6
Mutual exclusion
[thread.mutex]
33.6.4
Mutex requirements
[thread.mutex.requirements]
33.6.4.4
Shared mutex types
[thread.sharedmutex.requirements]
33.6.4.4.2
Class
shared_
mutex
[thread.sharedmutex.class]
🔗
namespace
std
{
class
shared_mutex
{
public
:
shared_mutex
(
)
;
~
shared_mutex
(
)
; shared_mutex
(
const
shared_mutex
&
)
=
delete
; shared_mutex
&
operator
=
(
const
shared_mutex
&
)
=
delete
;
// exclusive ownership
void
lock
(
)
;
// blocking
bool
try_lock
(
)
;
void
unlock
(
)
;
// shared ownership
void
lock_shared
(
)
;
// blocking
bool
try_lock_shared
(
)
;
void
unlock_shared
(
)
;
using
native_handle_type
=
implementation-defined
;
// see
[thread.
req.
native]
native_handle_type native_handle
(
)
;
// see
[thread.
req.
native]
}
;
}
1
#
The class
shared_
mutex
provides a non-recursive mutex with shared ownership semantics
.
2
#
The class
shared_
mutex
meets all of the shared mutex requirements (
[thread.
sharedmutex.
requirements]
)
.
It is a standard-layout class (
[class.
prop]
)
.
3
#
The behavior of a program is undefined if
(3.1)
it destroys a
shared_
mutex
object owned by any thread,
(3.2)
a thread attempts to recursively gain any ownership of a
shared_
mutex
, or
(3.3)
a thread terminates while possessing any ownership of a
shared_
mutex
.
4
#
shared_
mutex
may be a synonym for
shared_
timed_
mutex
.