STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Private Attributes | List of all members
condition_variable Class Reference

Public Types

typedef _Cnd_t native_handle_type
 

Public Member Functions

 condition_variable ()
 
 ~condition_variable () _NOEXCEPT
 
 condition_variable (const condition_variable &)=delete
 
condition_variableoperator= (const condition_variable &)=delete
 
void notify_one () _NOEXCEPT
 
void notify_all () _NOEXCEPT
 
void wait (unique_lock< mutex > &_Lck)
 
template<class _Predicate >
void wait (unique_lock< mutex > &_Lck, _Predicate _Pred)
 
template<class _Rep , class _Period >
_Cv_status wait_for (unique_lock< mutex > &_Lck, const chrono::duration< _Rep, _Period > &_Rel_time)
 
template<class _Rep , class _Period , class _Predicate >
bool wait_for (unique_lock< mutex > &_Lck, const chrono::duration< _Rep, _Period > &_Rel_time, _Predicate _Pred)
 
template<class _Clock , class _Duration >
_Cv_status wait_until (unique_lock< mutex > &_Lck, const chrono::time_point< _Clock, _Duration > &_Abs_time)
 
template<class _Clock , class _Duration , class _Predicate >
bool wait_until (unique_lock< mutex > &_Lck, const chrono::time_point< _Clock, _Duration > &_Abs_time, _Predicate _Pred)
 
_Cv_status wait_until (unique_lock< mutex > &_Lck, const xtime *_Abs_time)
 
template<class _Predicate >
bool wait_until (unique_lock< mutex > &_Lck, const xtime *_Abs_time, _Predicate _Pred)
 
native_handle_type native_handle ()
 
void _Register (unique_lock< mutex > &_Lck, int *_Ready)
 
void _Unregister (mutex &_Mtx)
 

Private Attributes

_Cnd_t _Cnd
 

Member Typedef Documentation

Constructor & Destructor Documentation

condition_variable::condition_variable ( )
inline
33  { // construct
34  _Cnd_initX(&_Cnd);
35  }
_Cnd_t _Cnd
Definition: condition_variable:153
int _Cnd_initX(_Cnd_t *_Cnd)
Definition: xthread:86
condition_variable::~condition_variable ( )
inline
38  { // destroy
40  }
_Cnd_t _Cnd
Definition: condition_variable:153
_CRTIMP2_PURE void __cdecl _Cnd_destroy(_Cnd_t *)
condition_variable::condition_variable ( const condition_variable )
delete

Member Function Documentation

void condition_variable::_Register ( unique_lock< mutex > &  _Lck,
int _Ready 
)
inline
143  { // register this object for release at thread exit
144  _Cnd_register_at_thread_exit(&_Cnd, &_Lck.release()->_Mtx, _Ready);
145  }
_Cnd_t _Cnd
Definition: condition_variable:153
_CRTIMP2_PURE int __cdecl _Cnd_register_at_thread_exit(_Cnd_t *, _Mtx_t *, int *)
_Mutex * release() _NOEXCEPT
Definition: mutex:337
void condition_variable::_Unregister ( mutex _Mtx)
inline
148  { // unregister this object for release at thread exit
149  _Cnd_unregister_at_thread_exit(&_Mtx._Mtx);
150  }
_CRTIMP2_PURE int __cdecl _Cnd_unregister_at_thread_exit(_Mtx_t *)
native_handle_type condition_variable::native_handle ( )
inline
138  { // return condition variable handle
139  return (_Cnd);
140  }
_Cnd_t _Cnd
Definition: condition_variable:153
void condition_variable::notify_all ( )
inline
51  { // wake up all waiters
53  }
_Cnd_t _Cnd
Definition: condition_variable:153
int _Cnd_broadcastX(_Cnd_t *_Cnd)
Definition: xthread:101
void condition_variable::notify_one ( )
inline
46  { // wake up one waiter
48  }
_Cnd_t _Cnd
Definition: condition_variable:153
int _Cnd_signalX(_Cnd_t *_Cnd)
Definition: xthread:106
condition_variable& condition_variable::operator= ( const condition_variable )
delete
void condition_variable::wait ( unique_lock< mutex > &  _Lck)
inline
56  { // wait for signal
57  _Cnd_waitX(&_Cnd, &_Lck.mutex()->_Mtx);
58  }
_Cnd_t _Cnd
Definition: condition_variable:153
_Mutex * mutex() const _NOEXCEPT
Definition: mutex:356
int _Cnd_waitX(_Cnd_t *_Cnd, _Mtx_t *_Mtx)
Definition: xthread:91
template<class _Predicate >
void condition_variable::wait ( unique_lock< mutex > &  _Lck,
_Predicate  _Pred 
)
inline
62  { // wait for signal and test predicate
63  while (!_Pred())
64  wait(_Lck);
65  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
void wait(unique_lock< mutex > &_Lck)
Definition: condition_variable:55
template<class _Rep , class _Period >
_Cv_status condition_variable::wait_for ( unique_lock< mutex > &  _Lck,
const chrono::duration< _Rep, _Period > &  _Rel_time 
)
inline
72  { // wait for duration
73  stdext::threads::xtime _Tgt = _To_xtime(_Rel_time);
74  return (wait_until(_Lck, &_Tgt));
75  }
xtime _To_xtime(const chrono::duration< _Rep, _Period > &_Rel_time)
Definition: chrono:736
struct xtime xtime
_Cv_status wait_until(unique_lock< mutex > &_Lck, const chrono::time_point< _Clock, _Duration > &_Abs_time)
Definition: condition_variable:91
template<class _Rep , class _Period , class _Predicate >
bool condition_variable::wait_for ( unique_lock< mutex > &  _Lck,
const chrono::duration< _Rep, _Period > &  _Rel_time,
_Predicate  _Pred 
)
inline
84  { // wait for signal with timeout and check predicate
85  stdext::threads::xtime _Tgt = _To_xtime(_Rel_time);
86  return (wait_until(_Lck, &_Tgt, _Pred));
87  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
xtime _To_xtime(const chrono::duration< _Rep, _Period > &_Rel_time)
Definition: chrono:736
struct xtime xtime
_Cv_status wait_until(unique_lock< mutex > &_Lck, const chrono::time_point< _Clock, _Duration > &_Abs_time)
Definition: condition_variable:91
template<class _Clock , class _Duration >
_Cv_status condition_variable::wait_until ( unique_lock< mutex > &  _Lck,
const chrono::time_point< _Clock, _Duration > &  _Abs_time 
)
inline
94  { // wait until time point
96  _Rel_time = _Abs_time - _Clock::now();
97  return (wait_for(_Lck, _Rel_time));
98  }
_Cv_status wait_for(unique_lock< mutex > &_Lck, const chrono::duration< _Rep, _Period > &_Rel_time)
Definition: condition_variable:69
_Duration duration
Definition: chrono:246
template<class _Clock , class _Duration , class _Predicate >
bool condition_variable::wait_until ( unique_lock< mutex > &  _Lck,
const chrono::time_point< _Clock, _Duration > &  _Abs_time,
_Predicate  _Pred 
)
inline
107  { // wait for signal with timeout and check predicate
109  _Rel_time = _Abs_time - _Clock::now();
110  return (wait_for(_Lck, _Rel_time, _Pred));
111  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Cv_status wait_for(unique_lock< mutex > &_Lck, const chrono::duration< _Rep, _Period > &_Rel_time)
Definition: condition_variable:69
_Duration duration
Definition: chrono:246
_Cv_status condition_variable::wait_until ( unique_lock< mutex > &  _Lck,
const xtime _Abs_time 
)
inline
116  { // wait for signal with timeout
117  if (!_Mtx_current_owns(&_Lck.mutex()->_Mtx))
119  int _Res = _Cnd_timedwaitX(&_Cnd, &_Lck.mutex()->_Mtx, _Abs_time);
120  return (_Res == _Thrd_timedout
122  }
_Cnd_t _Cnd
Definition: condition_variable:153
int _Cnd_timedwaitX(_Cnd_t *_Cnd, _Mtx_t *_Mtx, const xtime *_Xt)
Definition: xthread:96
_Mutex * mutex() const _NOEXCEPT
Definition: mutex:356
_CRTIMP2_PURE void __cdecl _Throw_Cpp_error(int code)
_CRTIMP2_PURE int __cdecl _Mtx_current_owns(_Mtx_t *)
Definition: xthreads.h:19
Definition: xthread:22
template<class _Predicate >
bool condition_variable::wait_until ( unique_lock< mutex > &  _Lck,
const xtime _Abs_time,
_Predicate  _Pred 
)
inline
129  { // wait for signal with timeout and check predicate
130  bool _Res = true;
131  while (_Res && !_Pred())
132  _Res = wait_until(_Lck, _Abs_time)
134  return (_Pred());
135  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Cv_status wait_until(unique_lock< mutex > &_Lck, const chrono::time_point< _Clock, _Duration > &_Abs_time)
Definition: condition_variable:91

Member Data Documentation

_Cnd_t condition_variable::_Cnd
private

The documentation for this class was generated from the following file: