libstdc++
Collaboration diagram for Mutexes:

Classes

struct  std::adopt_lock_t
 
struct  std::defer_lock_t
 
class  std::lock_guard< _Mutex >
 
class  std::mutex
 
struct  std::once_flag
 
class  std::recursive_mutex
 
class  std::recursive_timed_mutex
 
class  std::shared_lock< _Mutex >
 
class  std::shared_timed_mutex
 
class  std::timed_mutex
 
struct  std::try_to_lock_t
 
class  std::unique_lock< _Mutex >
 

Macros

#define __cpp_lib_shared_timed_mutex
 

Typedefs

typedef __gthread_mutex_t std::__mutex_base::__native_type
 
typedef __gthread_recursive_mutex_t std::__recursive_mutex_base::__native_type
 
typedef _Mutex std::lock_guard< _Mutex >::mutex_type
 
typedef _Mutex std::shared_lock< _Mutex >::mutex_type
 
typedef __native_type * std::mutex::native_handle_type
 
typedef __native_type * std::recursive_mutex::native_handle_type
 

Functions

 std::__mutex_base::__mutex_base (const __mutex_base &)=delete
 
 std::__recursive_mutex_base::__recursive_mutex_base (const __recursive_mutex_base &)=delete
 
 std::lock_guard< _Mutex >::lock_guard (const lock_guard &)=delete
 
 std::lock_guard< _Mutex >::lock_guard (mutex_type &__m)
 
 std::lock_guard< _Mutex >::lock_guard (mutex_type &__m, adopt_lock_t) noexcept
 
 std::mutex::mutex (const mutex &)=delete
 
constexpr std::once_flag::once_flag () noexcept=default
 
 std::once_flag::once_flag (const once_flag &)=delete
 
 std::recursive_mutex::recursive_mutex (const recursive_mutex &)=delete
 
 std::recursive_timed_mutex::recursive_timed_mutex (const recursive_timed_mutex &)=delete
 
 std::shared_lock< _Mutex >::shared_lock (mutex_type &__m)
 
 std::shared_lock< _Mutex >::shared_lock (mutex_type &__m, adopt_lock_t)
 
template<typename _Rep , typename _Period >
 std::shared_lock< _Mutex >::shared_lock (mutex_type &__m, const chrono::duration< _Rep, _Period > &__rel_time)
 
template<typename _Clock , typename _Duration >
 std::shared_lock< _Mutex >::shared_lock (mutex_type &__m, const chrono::time_point< _Clock, _Duration > &__abs_time)
 
 std::shared_lock< _Mutex >::shared_lock (mutex_type &__m, defer_lock_t) noexcept
 
 std::shared_lock< _Mutex >::shared_lock (mutex_type &__m, try_to_lock_t)
 
 std::shared_lock< _Mutex >::shared_lock (shared_lock &&__sl) noexcept
 
 std::shared_lock< _Mutex >::shared_lock (shared_lock const &)=delete
 
 std::shared_timed_mutex::shared_timed_mutex (const shared_timed_mutex &)=delete
 
 std::timed_mutex::timed_mutex (const timed_mutex &)=delete
 
template<typename _Callable , typename... _Args>
void std::call_once (once_flag &__once, _Callable &&__f, _Args &&... __args)
 
void std::mutex::lock ()
 
void std::recursive_mutex::lock ()
 
void std::timed_mutex::lock ()
 
void std::recursive_timed_mutex::lock ()
 
void std::shared_timed_mutex::lock ()
 
void std::shared_lock< _Mutex >::lock ()
 
template<typename _L1 , typename _L2 , typename... _L3>
void std::lock (_L1 &__l1, _L2 &__l2, _L3 &... __l3)
 
void std::shared_timed_mutex::lock_shared ()
 
mutex_type * std::shared_lock< _Mutex >::mutex () const noexcept
 
native_handle_type std::mutex::native_handle () noexcept
 
native_handle_type std::recursive_mutex::native_handle () noexcept
 
 std::shared_lock< _Mutex >::operator bool () const noexcept
 
bool std::recursive_timed_mutex::_Can_lock::operator() () const noexcept
 
__mutex_base & std::__mutex_base::operator= (const __mutex_base &)=delete
 
__recursive_mutex_base & std::__recursive_mutex_base::operator= (const __recursive_mutex_base &)=delete
 
lock_guardstd::lock_guard< _Mutex >::operator= (const lock_guard &)=delete
 
mutexstd::mutex::operator= (const mutex &)=delete
 
once_flagstd::once_flag::operator= (const once_flag &)=delete
 
recursive_mutexstd::recursive_mutex::operator= (const recursive_mutex &)=delete
 
recursive_timed_mutexstd::recursive_timed_mutex::operator= (const recursive_timed_mutex &)=delete
 
shared_timed_mutexstd::shared_timed_mutex::operator= (const shared_timed_mutex &)=delete
 
timed_mutexstd::timed_mutex::operator= (const timed_mutex &)=delete
 
shared_lockstd::shared_lock< _Mutex >::operator= (shared_lock &&__sl) noexcept
 
shared_lockstd::shared_lock< _Mutex >::operator= (shared_lock const &)=delete
 
bool std::shared_lock< _Mutex >::owns_lock () const noexcept
 
mutex_type * std::shared_lock< _Mutex >::release () noexcept
 
void std::shared_lock< _Mutex >::swap (shared_lock &__u) noexcept
 
bool std::timed_mutex::try_lock ()
 
bool std::recursive_timed_mutex::try_lock ()
 
bool std::shared_timed_mutex::try_lock ()
 
bool std::shared_lock< _Mutex >::try_lock ()
 
bool std::mutex::try_lock () noexcept
 
bool std::recursive_mutex::try_lock () noexcept
 
template<typename _Lock1 , typename _Lock2 , typename... _Lock3>
int std::try_lock (_Lock1 &__l1, _Lock2 &__l2, _Lock3 &... __l3)
 
template<typename _Rep , typename _Period >
bool std::shared_lock< _Mutex >::try_lock_for (const chrono::duration< _Rep, _Period > &__rel_time)
 
template<typename _Rep , typename _Period >
bool std::timed_mutex::try_lock_for (const chrono::duration< _Rep, _Period > &__rtime)
 
template<typename _Rep , typename _Period >
bool std::recursive_timed_mutex::try_lock_for (const chrono::duration< _Rep, _Period > &__rtime)
 
template<typename _Rep , typename _Period >
bool std::shared_timed_mutex::try_lock_for (const chrono::duration< _Rep, _Period > &__rtime)
 
bool std::shared_timed_mutex::try_lock_shared ()
 
template<typename _Rep , typename _Period >
bool std::shared_timed_mutex::try_lock_shared_for (const chrono::duration< _Rep, _Period > &__rtime)
 
template<typename _Clock , typename _Duration >
bool std::shared_timed_mutex::try_lock_shared_until (const chrono::time_point< _Clock, _Duration > &__abs_time)
 
template<typename _Clock , typename _Duration >
bool std::shared_timed_mutex::try_lock_until (const chrono::time_point< _Clock, _Duration > &__abs_time)
 
template<typename _Clock , typename _Duration >
bool std::shared_lock< _Mutex >::try_lock_until (const chrono::time_point< _Clock, _Duration > &__abs_time)
 
template<typename _Clock , typename _Duration >
bool std::timed_mutex::try_lock_until (const chrono::time_point< _Clock, _Duration > &__atime)
 
template<typename _Clock , typename _Duration >
bool std::recursive_timed_mutex::try_lock_until (const chrono::time_point< _Clock, _Duration > &__atime)
 
void std::mutex::unlock ()
 
void std::recursive_mutex::unlock ()
 
void std::timed_mutex::unlock ()
 
void std::recursive_timed_mutex::unlock ()
 
void std::shared_timed_mutex::unlock ()
 
void std::shared_lock< _Mutex >::unlock ()
 
void std::shared_timed_mutex::unlock_shared ()
 

Variables

thread::id std::recursive_timed_mutex::_Can_lock::_M_caller
 
__native_type std::__mutex_base::_M_mutex
 
__native_type std::__recursive_mutex_base::_M_mutex
 
const recursive_timed_mutexstd::recursive_timed_mutex::_Can_lock::_M_mx
 
constexpr adopt_lock_t std::adopt_lock
 
constexpr defer_lock_t std::defer_lock
 
constexpr try_to_lock_t std::try_to_lock
 

Friends

template<typename _Callable , typename... _Args>
void std::once_flag::call_once (once_flag &__once, _Callable &&__f, _Args &&... __args)
 

Detailed Description

Classes for mutex support.

Macro Definition Documentation

◆ __cpp_lib_shared_timed_mutex

#define __cpp_lib_shared_timed_mutex

Definition at line 56 of file shared_mutex.

Typedef Documentation

◆ __native_type [1/2]

typedef __gthread_mutex_t std::__mutex_base::__native_type
protected

Definition at line 60 of file std_mutex.h.

◆ __native_type [2/2]

typedef __gthread_recursive_mutex_t std::__recursive_mutex_base::__native_type
protected

Definition at line 68 of file mutex.

◆ mutex_type [1/2]

template<typename _Mutex >
typedef _Mutex std::lock_guard< _Mutex >::mutex_type

Definition at line 156 of file std_mutex.h.

◆ mutex_type [2/2]

template<typename _Mutex >
typedef _Mutex std::shared_lock< _Mutex >::mutex_type

Definition at line 713 of file shared_mutex.

◆ native_handle_type [1/2]

typedef __native_type* std::mutex::native_handle_type

Definition at line 86 of file std_mutex.h.

◆ native_handle_type [2/2]

typedef __native_type* std::recursive_mutex::native_handle_type

Definition at line 95 of file mutex.

Function Documentation

◆ __mutex_base()

std::__mutex_base::__mutex_base ( )
inlineprotectednoexcept

Definition at line 69 of file std_mutex.h.

◆ __recursive_mutex_base()

std::__recursive_mutex_base::__recursive_mutex_base ( )
inlineprotected

Definition at line 80 of file mutex.

◆ lock_guard() [1/2]

template<typename _Mutex >
std::lock_guard< _Mutex >::lock_guard ( mutex_type &  __m)
inlineexplicit

Definition at line 158 of file std_mutex.h.

◆ lock_guard() [2/2]

template<typename _Mutex >
std::lock_guard< _Mutex >::lock_guard ( mutex_type &  __m,
adopt_lock_t   
)
inlinenoexcept

Definition at line 161 of file std_mutex.h.

◆ once_flag() [1/2]

constexpr std::once_flag::once_flag ( )
constexprdefaultnoexcept

Constructor.

◆ once_flag() [2/2]

std::once_flag::once_flag ( const once_flag )
delete

Deleted copy constructor.

◆ shared_lock() [1/8]

template<typename _Mutex >
std::shared_lock< _Mutex >::shared_lock ( )
inlinenoexcept

Definition at line 717 of file shared_mutex.

◆ shared_lock() [2/8]

template<typename _Mutex >
std::shared_lock< _Mutex >::shared_lock ( mutex_type &  __m)
inlineexplicit

Definition at line 720 of file shared_mutex.

◆ shared_lock() [3/8]

template<typename _Mutex >
std::shared_lock< _Mutex >::shared_lock ( mutex_type &  __m,
adopt_lock_t   
)
inline

Definition at line 730 of file shared_mutex.

◆ shared_lock() [4/8]

template<typename _Mutex >
template<typename _Rep , typename _Period >
std::shared_lock< _Mutex >::shared_lock ( mutex_type &  __m,
const chrono::duration< _Rep, _Period > &  __rel_time 
)
inline

Definition at line 740 of file shared_mutex.

◆ shared_lock() [5/8]

template<typename _Mutex >
template<typename _Clock , typename _Duration >
std::shared_lock< _Mutex >::shared_lock ( mutex_type &  __m,
const chrono::time_point< _Clock, _Duration > &  __abs_time 
)
inline

Definition at line 734 of file shared_mutex.

◆ shared_lock() [6/8]

template<typename _Mutex >
std::shared_lock< _Mutex >::shared_lock ( mutex_type &  __m,
defer_lock_t   
)
inlinenoexcept

Definition at line 724 of file shared_mutex.

◆ shared_lock() [7/8]

template<typename _Mutex >
std::shared_lock< _Mutex >::shared_lock ( mutex_type &  __m,
try_to_lock_t   
)
inline

Definition at line 727 of file shared_mutex.

◆ shared_lock() [8/8]

template<typename _Mutex >
std::shared_lock< _Mutex >::shared_lock ( shared_lock< _Mutex > &&  __sl)
inlinenoexcept

Definition at line 754 of file shared_mutex.

◆ ~__mutex_base()

std::__mutex_base::~__mutex_base ( )
inlineprotectednoexcept

Definition at line 75 of file std_mutex.h.

◆ ~__recursive_mutex_base()

std::__recursive_mutex_base::~__recursive_mutex_base ( )
inlineprotected

Definition at line 86 of file mutex.

◆ ~lock_guard()

template<typename _Mutex >
std::lock_guard< _Mutex >::~lock_guard ( )
inline

Definition at line 164 of file std_mutex.h.

◆ ~recursive_timed_mutex()

std::recursive_timed_mutex::~recursive_timed_mutex ( )
inline

Definition at line 430 of file mutex.

◆ ~shared_lock()

template<typename _Mutex >
std::shared_lock< _Mutex >::~shared_lock ( )
inline

Definition at line 745 of file shared_mutex.

◆ ~timed_mutex()

std::timed_mutex::~timed_mutex ( )
inline

Definition at line 352 of file mutex.

◆ call_once()

template<typename _Callable , typename... _Args>
void std::call_once ( once_flag __once,
_Callable &&  __f,
_Args &&...  __args 
)

Invoke a callable and synchronize with other calls using the same flag.

Definition at line 712 of file mutex.

◆ lock() [1/7]

void std::mutex::lock ( )
inline

Definition at line 98 of file std_mutex.h.

◆ lock() [2/7]

void std::recursive_mutex::lock ( )
inline

Definition at line 104 of file mutex.

◆ lock() [3/7]

void std::timed_mutex::lock ( )
inline

Definition at line 358 of file mutex.

◆ lock() [4/7]

void std::recursive_timed_mutex::lock ( )
inline

Definition at line 436 of file mutex.

◆ lock() [5/7]

void std::shared_timed_mutex::lock ( )
inline

Definition at line 468 of file shared_mutex.

◆ lock() [6/7]

template<typename _Mutex >
void std::shared_lock< _Mutex >::lock ( )
inline

Definition at line 765 of file shared_mutex.

◆ lock() [7/7]

template<typename _L1 , typename _L2 , typename... _L3>
void std::lock ( _L1 &  __l1,
_L2 &  __l2,
_L3 &...  __l3 
)

Generic lock.

Parameters
__l1Meets Lockable requirements (try_lock() may throw).
__l2Meets Lockable requirements (try_lock() may throw).
__l3Meets Lockable requirements (try_lock() may throw).
Exceptions
Anexception thrown by an argument's lock() or try_lock() member.
Postcondition
All arguments are locked.

All arguments are locked via a sequence of calls to lock(), try_lock() and unlock(). If the call exits via an exception any locks that were obtained will be released.

Definition at line 589 of file mutex.

References std::tie().

◆ lock_shared()

void std::shared_timed_mutex::lock_shared ( )
inline

Definition at line 484 of file shared_mutex.

◆ mutex()

template<typename _Mutex >
mutex_type * std::shared_lock< _Mutex >::mutex ( ) const
inlinenoexcept

Definition at line 826 of file shared_mutex.

◆ native_handle() [1/2]

native_handle_type std::mutex::native_handle ( )
inlinenoexcept

Definition at line 122 of file std_mutex.h.

◆ native_handle() [2/2]

native_handle_type std::recursive_mutex::native_handle ( )
inlinenoexcept

Definition at line 128 of file mutex.

◆ operator bool()

template<typename _Mutex >
std::shared_lock< _Mutex >::operator bool ( ) const
inlineexplicitnoexcept

Definition at line 824 of file shared_mutex.

◆ operator()()

bool std::recursive_timed_mutex::_Can_lock::operator() ( ) const
inlinenoexcept

Definition at line 420 of file mutex.

◆ operator=() [1/2]

once_flag & std::once_flag::operator= ( const once_flag )
delete

Deleted assignment operator.

◆ operator=() [2/2]

template<typename _Mutex >
shared_lock & std::shared_lock< _Mutex >::operator= ( shared_lock< _Mutex > &&  __sl)
inlinenoexcept

Definition at line 758 of file shared_mutex.

◆ owns_lock()

template<typename _Mutex >
bool std::shared_lock< _Mutex >::owns_lock ( ) const
inlinenoexcept

Definition at line 822 of file shared_mutex.

◆ release()

template<typename _Mutex >
mutex_type * std::shared_lock< _Mutex >::release ( )
inlinenoexcept

Definition at line 814 of file shared_mutex.

◆ swap()

template<typename _Mutex >
void std::shared_lock< _Mutex >::swap ( shared_lock< _Mutex > &  __u)
inlinenoexcept

Definition at line 807 of file shared_mutex.

◆ try_lock() [1/7]

bool std::timed_mutex::try_lock ( )
inline

Definition at line 366 of file mutex.

◆ try_lock() [2/7]

bool std::recursive_timed_mutex::try_lock ( )
inline

Definition at line 449 of file mutex.

◆ try_lock() [3/7]

bool std::shared_timed_mutex::try_lock ( )
inline

Definition at line 469 of file shared_mutex.

◆ try_lock() [4/7]

template<typename _Mutex >
bool std::shared_lock< _Mutex >::try_lock ( )
inline

Definition at line 773 of file shared_mutex.

◆ try_lock() [5/7]

bool std::mutex::try_lock ( )
inlinenoexcept

Definition at line 108 of file std_mutex.h.

◆ try_lock() [6/7]

bool std::recursive_mutex::try_lock ( )
inlinenoexcept

Definition at line 114 of file mutex.

◆ try_lock() [7/7]

template<typename _Lock1 , typename _Lock2 , typename... _Lock3>
int std::try_lock ( _Lock1 &  __l1,
_Lock2 &  __l2,
_Lock3 &...  __l3 
)

Generic try_lock.

Parameters
__l1Meets Lockable requirements (try_lock() may throw).
__l2Meets Lockable requirements (try_lock() may throw).
__l3Meets Lockable requirements (try_lock() may throw).
Returns
Returns -1 if all try_lock() calls return true. Otherwise returns a 0-based index corresponding to the argument that returned false.
Postcondition
Either all arguments are locked, or none will be.

Sequentially calls try_lock() on each argument.

Definition at line 568 of file mutex.

References std::tie().

◆ try_lock_for() [1/4]

template<typename _Mutex >
template<typename _Rep , typename _Period >
bool std::shared_lock< _Mutex >::try_lock_for ( const chrono::duration< _Rep, _Period > &  __rel_time)
inline

Definition at line 781 of file shared_mutex.

◆ try_lock_for() [2/4]

template<typename _Rep , typename _Period >
bool std::timed_mutex::try_lock_for ( const chrono::duration< _Rep, _Period > &  __rtime)
inline

Definition at line 377 of file mutex.

◆ try_lock_for() [3/4]

template<typename _Rep , typename _Period >
bool std::recursive_timed_mutex::try_lock_for ( const chrono::duration< _Rep, _Period > &  __rtime)
inline

Definition at line 465 of file mutex.

◆ try_lock_for() [4/4]

template<typename _Rep , typename _Period >
bool std::shared_timed_mutex::try_lock_for ( const chrono::duration< _Rep, _Period > &  __rtime)
inline

Definition at line 474 of file shared_mutex.

◆ try_lock_shared()

bool std::shared_timed_mutex::try_lock_shared ( )
inline

Definition at line 485 of file shared_mutex.

◆ try_lock_shared_for()

template<typename _Rep , typename _Period >
bool std::shared_timed_mutex::try_lock_shared_for ( const chrono::duration< _Rep, _Period > &  __rtime)
inline

Definition at line 490 of file shared_mutex.

◆ try_lock_shared_until()

template<typename _Clock , typename _Duration >
bool std::shared_timed_mutex::try_lock_shared_until ( const chrono::time_point< _Clock, _Duration > &  __abs_time)
inline

Definition at line 691 of file shared_mutex.

◆ try_lock_until() [1/4]

template<typename _Clock , typename _Duration >
bool std::shared_timed_mutex::try_lock_until ( const chrono::time_point< _Clock, _Duration > &  __abs_time)
inline

Definition at line 667 of file shared_mutex.

◆ try_lock_until() [2/4]

template<typename _Mutex >
template<typename _Clock , typename _Duration >
bool std::shared_lock< _Mutex >::try_lock_until ( const chrono::time_point< _Clock, _Duration > &  __abs_time)
inline

Definition at line 789 of file shared_mutex.

◆ try_lock_until() [3/4]

template<typename _Clock , typename _Duration >
bool std::timed_mutex::try_lock_until ( const chrono::time_point< _Clock, _Duration > &  __atime)
inline

Definition at line 388 of file mutex.

◆ try_lock_until() [4/4]

template<typename _Clock , typename _Duration >
bool std::recursive_timed_mutex::try_lock_until ( const chrono::time_point< _Clock, _Duration > &  __atime)
inline

Definition at line 481 of file mutex.

◆ unlock() [1/6]

void std::mutex::unlock ( )
inline

Definition at line 115 of file std_mutex.h.

◆ unlock() [2/6]

void std::recursive_mutex::unlock ( )
inline

Definition at line 121 of file mutex.

◆ unlock() [3/6]

void std::timed_mutex::unlock ( )
inline

Definition at line 398 of file mutex.

◆ unlock() [4/6]

void std::recursive_timed_mutex::unlock ( )
inline

Definition at line 496 of file mutex.

◆ unlock() [5/6]

void std::shared_timed_mutex::unlock ( )
inline

Definition at line 470 of file shared_mutex.

◆ unlock() [6/6]

template<typename _Mutex >
void std::shared_lock< _Mutex >::unlock ( )
inline

Definition at line 796 of file shared_mutex.

◆ unlock_shared()

void std::shared_timed_mutex::unlock_shared ( )
inline

Definition at line 486 of file shared_mutex.

Variable Documentation

◆ _M_caller

thread::id std::recursive_timed_mutex::_Can_lock::_M_caller

Definition at line 424 of file mutex.

◆ _M_mutex [1/2]

__native_type std::__mutex_base::_M_mutex
protected

Definition at line 67 of file std_mutex.h.

◆ _M_mutex [2/2]

__native_type std::__recursive_mutex_base::_M_mutex
protected

Definition at line 78 of file mutex.

◆ _M_mx

const recursive_timed_mutex* std::recursive_timed_mutex::_Can_lock::_M_mx

Definition at line 423 of file mutex.

◆ adopt_lock

constexpr adopt_lock_t std::adopt_lock
inlineconstexpr

Tag used to make a scoped lock take ownership of a locked mutex.

Definition at line 145 of file std_mutex.h.

◆ defer_lock

constexpr defer_lock_t std::defer_lock
inlineconstexpr

Tag used to prevent a scoped lock from acquiring ownership of a mutex.

Definition at line 139 of file std_mutex.h.

◆ try_to_lock

constexpr try_to_lock_t std::try_to_lock
inlineconstexpr

Tag used to prevent a scoped lock from blocking if a mutex is locked.

Definition at line 142 of file std_mutex.h.

Friends

◆ call_once

template<typename _Callable , typename... _Args>
void call_once ( once_flag __once,
_Callable &&  __f,
_Args &&...  __args 
)
friend

Invoke a callable and synchronize with other calls using the same flag.

Definition at line 712 of file mutex.