33
Concurrency support library
[thread]
33.6
Mutual exclusion
[thread.mutex]
33.6.2
Header
<mutex>
synopsis
[mutex.syn]
🔗
namespace
std
{
//
[thread.
mutex.
class]
, class
mutex
class
mutex;
//
[thread.
mutex.
recursive]
, class
recursive_
mutex
class
recursive_mutex;
//
[thread.
timedmutex.
class]
class
timed_
mutex
class
timed_mutex;
//
[thread.
timedmutex.
recursive]
, class
recursive_
timed_
mutex
class
recursive_timed_mutex;
struct
defer_lock_t
{
explicit
defer_lock_t
(
)
=
default
;
}
;
struct
try_to_lock_t
{
explicit
try_to_lock_t
(
)
=
default
;
}
;
struct
adopt_lock_t
{
explicit
adopt_lock_t
(
)
=
default
;
}
;
inline
constexpr
defer_lock_t defer_lock
{
}
;
inline
constexpr
try_to_lock_t try_to_lock
{
}
;
inline
constexpr
adopt_lock_t adopt_lock
{
}
;
//
[thread.
lock]
, locks
template
<
class
Mutex
>
class
lock_guard;
template
<
class
.
.
.
MutexTypes
>
class
scoped_lock;
template
<
class
Mutex
>
class
unique_lock;
template
<
class
Mutex
>
void
swap
(
unique_lock
<
Mutex
>
&
x, unique_lock
<
Mutex
>
&
y
)
noexcept
;
//
[thread.
lock.
algorithm]
, generic locking algorithms
template
<
class
L1,
class
L2,
class
.
.
.
L3
>
int
try_lock
(
L1
&
, L2
&
, L3
&
.
.
.
)
;
template
<
class
L1,
class
L2,
class
.
.
.
L3
>
void
lock
(
L1
&
, L2
&
, L3
&
.
.
.
)
;
struct
once_flag;
template
<
class
Callable,
class
.
.
.
Args
>
void
call_once
(
once_flag
&
flag, Callable
&
&
func, Args
&
&
.
.
.
args
)
;
}