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, integer_sequence< size_t, _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), make_integer_sequence< size_t, sizeof...(_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 
528  { // names for wait returns
529  no_timeout,
530  timeout
531  };

Function Documentation

template<class _Tuple , class _Seq , size_t _Idx>
int __stdcall _Callback_once ( void ,
void _Pv,
void **   
)
inline
492  { // adapt call_once() to callback API
493  _Tuple *_Ptup = static_cast<_Tuple *>(_Pv);
494 
495  _TRY_BEGIN
496  // Note explicit _Seq() selects every element from *_Ptup except the last, which contains call_once's exception_ptr.
497  _Invoke_stored_explicit(_STD move(*_Ptup), _Seq());
498  _CATCH_ALL
499  auto& _Ref = _STD get<_Idx>(*_Ptup);
500  _Ref = _XSTD current_exception();
501  return (0);
502  _CATCH_END
503 
504  return (1);
505  }
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
#define _XSTD
Definition: xstddef:21
#define _CATCH_ALL
Definition: xstddef:62
auto _Invoke_stored_explicit(tuple< _Types...> &&_Tuple, integer_sequence< size_t, _Indices...>) -> decltype(_STD invoke(_STD get< _Indices >(_STD move(_Tuple))...))
Definition: mutex:467
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
exception_ptr current_exception() _NOEXCEPT
Definition: exception:359
_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), make_integer_sequence<size_t, sizeof...(_Types)>()))
inline
477  { // invoke() a tuple
478  return (_Invoke_stored_explicit(_STD move(_Tuple), make_integer_sequence<size_t, sizeof...(_Types)>()));
479  }
auto _Invoke_stored_explicit(tuple< _Types...> &&_Tuple, integer_sequence< size_t, _Indices...>) -> decltype(_STD invoke(_STD get< _Indices >(_STD move(_Tuple))...))
Definition: mutex:467
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
__make_integer_seq< integer_sequence, _Ty, _Size > make_integer_sequence
Definition: type_traits:1245
template<class... _Types, size_t... _Indices>
auto _Invoke_stored_explicit ( tuple< _Types...> &&  _Tuple,
integer_sequence< size_t, _Indices...>   
) -> decltype(_STD invoke(_STD get<_Indices>(_STD move(_Tuple))...))
inline
469  { // invoke() a tuple with explicit parameter ordering
470  return (_STD invoke(_STD get<_Indices>(_STD move(_Tuple))...));
471  }
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
auto invoke(_Callable &&_Obj, _Types &&..._Args) -> decltype(_Invoker< _Callable, _Types...>::_Call(_STD forward< _Callable >(_Obj), _STD forward< _Types >(_Args)...))
Definition: type_traits:1439
template<class _Lock0 >
int _Try_lock ( _Lock0 &  _Lk0)
inline
116  { // try to lock one mutex
117  if (!_Lk0.try_lock())
118  return (0);
119  else
120  return (-1);
121  }
template<class _Lock0 , class _Lock1 , class... _LockN>
int _Try_lock ( _Lock0 &  _Lk0,
_Lock1 &  _Lk1,
_LockN &...  _LkN 
)
inline
127  { // try to lock n-1 mutexes
128  int _Res;
129  if (!_Lk0.try_lock())
130  return (0);
131  _TRY_BEGIN
132  // handle exceptions from tail lock
133  if ((_Res = _STD try_lock(_Lk1, _LkN...)) != -1)
134  { // tail lock failed
135  _Lk0.unlock();
136  ++_Res;
137  }
138  _CATCH_ALL
139  // tail lock threw exception
140  _Lk0.unlock();
141  throw;
142  _CATCH_END
143  return (_Res);
144  }
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
#define _CATCH_ALL
Definition: xstddef:62
int try_lock(_Lock0 &, _LockN &...)
template<class _Fn , class... _Args>
void() call_once ( once_flag _Flag,
_Fn &&  _Fx,
_Args &&...  _Ax 
)
inline
510  { // call _Fx(_Ax...) once
511  typedef tuple<_Fn&&, _Args&&..., _XSTD exception_ptr&> _Tuple;
512  typedef make_integer_sequence<size_t, 1 + sizeof...(_Args)> _Seq;
513 
514  _XSTD exception_ptr _Exc;
515  _Tuple _Tup(_STD forward<_Fn>(_Fx), _STD forward<_Args>(_Ax)..., _Exc);
516 
517  _Lambda_fp_t _Fp = &_Callback_once<_Tuple, _Seq, 1 + sizeof...(_Args)>;
518 
519  if (_Execute_once(_Flag, _Fp, _STD addressof(_Tup)) != 0)
520  return;
521 
522  if (_Exc)
523  _XSTD rethrow_exception(_Exc);
524 
525  _XGetLastError();
526  }
int __stdcall _Callback_once(void *, void *_Pv, void **)
Definition: mutex:491
constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:723
Definition: exception:254
#define _XSTD
Definition: xstddef:21
_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Execute_once(once_flag &_Flag, _Lambda_fp_t _Lambda_fp, void *_Pv) _NOEXCEPT
unsigned int size_t
Definition: sourceannotations.h:19
Definition: tuple:226
void rethrow_exception(_In_ exception_ptr _Ptr)
Definition: exception:364
int(__stdcall * _Lambda_fp_t)(void *, void *, void **)
Definition: mutex:482
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _XGetLastError()
__make_integer_seq< integer_sequence, _Ty, _Size > make_integer_sequence
Definition: type_traits:1245
template<class _Lock0 , class _Lock1 , class... _LockN>
void lock ( _Lock0 &  _Lk0,
_Lock1 &  _Lk1,
_LockN &...  _LkN 
)
inline
158  { // lock N mutexes
159  int _Res = 0;
160  while (_Res != -1)
161  _Res = _Try_lock(_Lk0, _Lk1, _LkN...);
162  }
int _Try_lock(_Lock0 &_Lk0)
Definition: mutex:115
template<class _Mutex >
void swap ( unique_lock< _Mutex > &  _Left,
unique_lock< _Mutex > &  _Right 
)
446  { // swap _Left and _Right
447  _Left.swap(_Right);
448  }
void swap(unique_lock &_Other) _NOEXCEPT
Definition: mutex:396
template<class _Lock0 , class... _LockN>
int try_lock ( _Lock0 &  ,
_LockN &  ... 
)
inline
template<class _Lock0 , class... _LockN>
int try_lock ( _Lock0 &  _Lk0,
_LockN &...  _LkN 
)
inline
149  { // try to lock n-1 mutexes
150  return (_Try_lock(_Lk0, _LkN...));
151  }
int _Try_lock(_Lock0 &_Lk0)
Definition: mutex:115

Variable Documentation

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