STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Macros | Typedefs | Enumerations | Functions | Variables
mutex File Reference
#include <chrono>
#include <functional>
#include <system_error>
#include <thread>
#include <tuple>
#include <utility>

Classes

class  _Mutex_base
 
class  mutex
 
class  recursive_mutex
 
struct  adopt_lock_t
 
struct  defer_lock_t
 
struct  try_to_lock_t
 
class  lock_guard< _Mutexes >
 
class  lock_guard< _Mutex >
 
class  lock_guard<>
 
class  unique_lock< _Mutex >
 
struct  once_flag
 
class  condition_variable
 
class  timed_mutex
 
class  recursive_timed_mutex
 

Macros

#define _MUTEX_
 

Typedefs

typedef int(__stdcall * _Lambda_fp_t) (void *, void *, void **)
 
typedef cv_status _Cv_status
 

Enumerations

enum  cv_status { cv_status::no_timeout, cv_status::timeout }
 

Functions

template<class _Lock0 , class... _LockN>
int try_lock (_Lock0 &, _LockN &...)
 
template<class _Lock0 >
int _Try_lock (_Lock0 &_Lk0)
 
template<class _Lock0 , class _Lock1 , class... _LockN>
int _Try_lock (_Lock0 &_Lk0, _Lock1 &_Lk1, _LockN &..._LkN)
 
template<class _Lock0 , class... _LockN>
int try_lock (_Lock0 &_Lk0, _LockN &..._LkN)
 
template<class _Lock0 , class _Lock1 , class... _LockN>
void lock (_Lock0 &_Lk0, _Lock1 &_Lk1, _LockN &..._LkN)
 
template<class _Mutex >
void swap (unique_lock< _Mutex > &_Left, unique_lock< _Mutex > &_Right) _NOEXCEPT
 
template<class... _Types, size_t... _Indices>
auto _Invoke_stored_explicit (tuple< _Types...> &&_Tuple, index_sequence< _Indices...>) -> decltype(_STD invoke(_STD get< _Indices >(_STD move(_Tuple))...))
 
template<class... _Types>
auto _Invoke_stored (tuple< _Types...> &&_Tuple) -> decltype(_Invoke_stored_explicit(_STD move(_Tuple), index_sequence_for< _Types...>()))
 
_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Execute_once (once_flag &_Flag, _Lambda_fp_t _Lambda_fp, void *_Pv) _NOEXCEPT
 
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _XGetLastError ()
 
template<class _Tuple , class _Seq , size_t _Idx>
int __stdcall _Callback_once (void *, void *_Pv, void **)
 
template<class _Fn , class... _Args>
void() call_once (once_flag &_Flag, _Fn &&_Fx, _Args &&..._Ax)
 

Variables

constexpr adopt_lock_t adopt_lock {}
 
constexpr defer_lock_t defer_lock {}
 
constexpr try_to_lock_t try_to_lock {}
 

Macro Definition Documentation

#define _MUTEX_

Typedef Documentation

typedef int(__stdcall * _Lambda_fp_t) (void *, void *, void **)

Enumeration Type Documentation

enum cv_status
strong
Enumerator
no_timeout 
timeout 
529  { // names for wait returns
530  no_timeout,
531  timeout
532  };

Function Documentation

template<class _Tuple , class _Seq , size_t _Idx>
int __stdcall _Callback_once ( void ,
void _Pv,
void **   
)
inline
493  { // adapt call_once() to callback API
494  _Tuple *_Ptup = static_cast<_Tuple *>(_Pv);
495 
496  _TRY_BEGIN
497  // Note explicit _Seq() selects every element from *_Ptup except the last, which contains call_once's exception_ptr.
498  _Invoke_stored_explicit(_STD move(*_Ptup), _Seq());
499  _CATCH_ALL
500  auto& _Ref = _STD get<_Idx>(*_Ptup);
501  _Ref = _STD current_exception();
502  return (0);
503  _CATCH_END
504 
505  return (1);
506  }
#define _TRY_BEGIN
Definition: xstddef:26
#define _CATCH_END
Definition: xstddef:29
auto _Invoke_stored_explicit(tuple< _Types...> &&_Tuple, index_sequence< _Indices...>) -> decltype(_STD invoke(_STD get< _Indices >(_STD move(_Tuple))...))
Definition: mutex:468
#define _CATCH_ALL
Definition: xstddef:28
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
exception_ptr current_exception() _NOEXCEPT
Definition: exception:366
_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Execute_once ( once_flag _Flag,
_Lambda_fp_t  _Lambda_fp,
void _Pv 
)
template<class... _Types>
auto _Invoke_stored ( tuple< _Types...> &&  _Tuple) -> decltype(_Invoke_stored_explicit(_STD move(_Tuple), index_sequence_for<_Types...>()))
inline
478  { // invoke() a tuple
480  }
auto _Invoke_stored_explicit(tuple< _Types...> &&_Tuple, index_sequence< _Indices...>) -> decltype(_STD invoke(_STD get< _Indices >(_STD move(_Tuple))...))
Definition: mutex:468
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
make_index_sequence< sizeof...(_Types)> index_sequence_for
Definition: type_traits:1293
template<class... _Types, size_t... _Indices>
auto _Invoke_stored_explicit ( tuple< _Types...> &&  _Tuple,
index_sequence< _Indices...>   
) -> decltype(_STD invoke(_STD get<_Indices>(_STD move(_Tuple))...))
inline
470  { // invoke() a tuple with explicit parameter ordering
471  return (_STD invoke(_STD get<_Indices>(_STD move(_Tuple))...));
472  }
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
template<class _Lock0 >
int _Try_lock ( _Lock0 &  _Lk0)
inline
117  { // try to lock one mutex
118  if (!_Lk0.try_lock())
119  return (0);
120  else
121  return (-1);
122  }
template<class _Lock0 , class _Lock1 , class... _LockN>
int _Try_lock ( _Lock0 &  _Lk0,
_Lock1 &  _Lk1,
_LockN &...  _LkN 
)
inline
128  { // try to lock n-1 mutexes
129  int _Res;
130  if (!_Lk0.try_lock())
131  return (0);
132  _TRY_BEGIN
133  // handle exceptions from tail lock
134  if ((_Res = _STD try_lock(_Lk1, _LkN...)) != -1)
135  { // tail lock failed
136  _Lk0.unlock();
137  ++_Res;
138  }
139  _CATCH_ALL
140  // tail lock threw exception
141  _Lk0.unlock();
142  throw;
143  _CATCH_END
144  return (_Res);
145  }
#define _TRY_BEGIN
Definition: xstddef:26
#define _CATCH_END
Definition: xstddef:29
#define _CATCH_ALL
Definition: xstddef:28
int try_lock(_Lock0 &, _LockN &...)
template<class _Fn , class... _Args>
void() call_once ( once_flag _Flag,
_Fn &&  _Fx,
_Args &&...  _Ax 
)
inline
511  { // call _Fx(_Ax...) once
512  typedef tuple<_Fn&&, _Args&&..., exception_ptr&> _Tuple;
513  typedef make_index_sequence<1 + sizeof...(_Args)> _Seq;
514 
515  exception_ptr _Exc;
516  _Tuple _Tup(_STD forward<_Fn>(_Fx), _STD forward<_Args>(_Ax)..., _Exc);
517 
518  _Lambda_fp_t _Fp = &_Callback_once<_Tuple, _Seq, 1 + sizeof...(_Args)>;
519 
520  if (_Execute_once(_Flag, _Fp, _STD addressof(_Tup)) != 0)
521  return;
522 
523  if (_Exc)
524  _STD rethrow_exception(_Exc);
525 
526  _XGetLastError();
527  }
int __stdcall _Callback_once(void *, void *_Pv, void **)
Definition: mutex:492
_STD_BEGIN constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:628
Definition: exception:254
_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Execute_once(once_flag &_Flag, _Lambda_fp_t _Lambda_fp, void *_Pv) _NOEXCEPT
make_integer_sequence< size_t, _Size > make_index_sequence
Definition: type_traits:1290
Definition: tuple:220
void rethrow_exception(_In_ exception_ptr _Ptr)
Definition: exception:371
int(__stdcall * _Lambda_fp_t)(void *, void *, void **)
Definition: mutex:483
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _XGetLastError()
template<class _Lock0 , class _Lock1 , class... _LockN>
void lock ( _Lock0 &  _Lk0,
_Lock1 &  _Lk1,
_LockN &...  _LkN 
)
inline
159  { // lock N mutexes
160  int _Res = 0;
161  while (_Res != -1)
162  _Res = _Try_lock(_Lk0, _Lk1, _LkN...);
163  }
int _Try_lock(_Lock0 &_Lk0)
Definition: mutex:116
template<class _Mutex >
void swap ( unique_lock< _Mutex > &  _Left,
unique_lock< _Mutex > &  _Right 
)
447  { // swap _Left and _Right
448  _Left.swap(_Right);
449  }
void swap(unique_lock &_Other) _NOEXCEPT
Definition: mutex:397
template<class _Lock0 , class... _LockN>
int try_lock ( _Lock0 &  ,
_LockN &  ... 
)
inline
template<class _Lock0 , class... _LockN>
int try_lock ( _Lock0 &  _Lk0,
_LockN &...  _LkN 
)
inline
150  { // try to lock n-1 mutexes
151  return (_Try_lock(_Lk0, _LkN...));
152  }
int _Try_lock(_Lock0 &_Lk0)
Definition: mutex:116

Variable Documentation

constexpr adopt_lock_t adopt_lock {}
constexpr defer_lock_t defer_lock {}
constexpr try_to_lock_t try_to_lock {}