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

Public Member Functions

 condition_variable_any ()
 
 ~condition_variable_any () _NOEXCEPT
 
 condition_variable_any (const condition_variable_any &)=delete
 
condition_variable_anyoperator= (const condition_variable_any &)=delete
 
void notify_one () _NOEXCEPT
 
void notify_all () _NOEXCEPT
 
template<class _Mutex >
void wait (_Mutex &_Xtrnl)
 
template<class _Mutex , class _Predicate >
void wait (_Mutex &_Xtrnl, _Predicate _Pred)
 
template<class _Lock , class _Rep , class _Period >
_Cv_status wait_for (_Lock &_Lck, const chrono::duration< _Rep, _Period > &_Rel_time)
 
template<class _Lock , class _Rep , class _Period , class _Predicate >
bool wait_for (_Lock &_Lck, const chrono::duration< _Rep, _Period > &_Rel_time, _Predicate _Pred)
 
template<class _Lock , class _Clock , class _Duration >
_Cv_status wait_until (_Lock &_Lck, const chrono::time_point< _Clock, _Duration > &_Abs_time)
 
template<class _Lock , class _Clock , class _Duration , class _Predicate >
bool wait_until (_Lock &_Lck, const chrono::time_point< _Clock, _Duration > &_Abs_time, _Predicate _Pred)
 
template<class _Mutex >
_Cv_status wait_until (_Mutex &_Xtrnl, const xtime *_Abs_time)
 
template<class _Mutex , class _Predicate >
bool wait_until (_Mutex &_Xtrnl, const xtime *_Abs_time, _Predicate _Pred)
 

Private Member Functions

_Cnd_t _Mycnd () _NOEXCEPT
 

Private Attributes

shared_ptr< mutex_Myptr
 
aligned_storage< _Cnd_internal_imp_size, _Cnd_internal_imp_alignment >::type _Cnd_storage
 

Constructor & Destructor Documentation

condition_variable_any::condition_variable_any ( )
inline
25  { // construct
26  _Myptr = _STD make_shared<mutex>();
28  }
_CRTIMP2_PURE void __cdecl _Cnd_init_in_situ(_Cnd_t)
shared_ptr< mutex > _Myptr
Definition: condition_variable:154
_Cnd_t _Mycnd() _NOEXCEPT
Definition: condition_variable:159
condition_variable_any::~condition_variable_any ( )
inline
31  { // destroy
33  }
_Cnd_t _Mycnd() _NOEXCEPT
Definition: condition_variable:159
_CRTIMP2_PURE void __cdecl _Cnd_destroy_in_situ(_Cnd_t)
condition_variable_any::condition_variable_any ( const condition_variable_any )
delete

Member Function Documentation

_Cnd_t condition_variable_any::_Mycnd ( )
inlineprivate
160  { // get pointer to _Cnd_internal_imp_t inside _Cnd_storage
161  return (reinterpret_cast<_Cnd_t>(&_Cnd_storage));
162  }
aligned_storage< _Cnd_internal_imp_size, _Cnd_internal_imp_alignment >::type _Cnd_storage
Definition: condition_variable:157
void condition_variable_any::notify_all ( )
inline
46  { // wake up all waiters
47  _Myptr->lock();
49  _Myptr->unlock();
50  }
void lock()
Definition: mutex:41
shared_ptr< mutex > _Myptr
Definition: condition_variable:154
int _Cnd_broadcastX(_Cnd_t _Cnd)
Definition: xthread:104
_Cnd_t _Mycnd() _NOEXCEPT
Definition: condition_variable:159
void unlock()
Definition: mutex:51
void condition_variable_any::notify_one ( )
inline
39  { // wake up one waiter
40  _Myptr->lock();
42  _Myptr->unlock();
43  }
void lock()
Definition: mutex:41
shared_ptr< mutex > _Myptr
Definition: condition_variable:154
_Cnd_t _Mycnd() _NOEXCEPT
Definition: condition_variable:159
void unlock()
Definition: mutex:51
int _Cnd_signalX(_Cnd_t _Cnd)
Definition: xthread:109
condition_variable_any& condition_variable_any::operator= ( const condition_variable_any )
delete
template<class _Mutex >
void condition_variable_any::wait ( _Mutex &  _Xtrnl)
inline
54  { // wait for signal
55  shared_ptr<mutex> _Ptr = _Myptr; // immune to *this destruction
56  _Ptr->lock();
57  _Xtrnl.unlock();
58  _Cnd_waitX(_Mycnd(), _Ptr->_Mymtx());
59  _Ptr->unlock();
60  _Xtrnl.lock();
61  }
void lock()
Definition: mutex:41
shared_ptr< mutex > _Myptr
Definition: condition_variable:154
_Cnd_t _Mycnd() _NOEXCEPT
Definition: condition_variable:159
void unlock()
Definition: mutex:51
int _Cnd_waitX(_Cnd_t _Cnd, _Mtx_t _Mtx)
Definition: xthread:93
template<class _Mutex , class _Predicate >
void condition_variable_any::wait ( _Mutex &  _Xtrnl,
_Predicate  _Pred 
)
inline
66  { // wait for signal and check predicate
67  while (!_Pred())
68  wait(_Xtrnl);
69  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
void wait(_Mutex &_Xtrnl)
Definition: condition_variable:53
template<class _Lock , class _Rep , class _Period >
_Cv_status condition_variable_any::wait_for ( _Lock &  _Lck,
const chrono::duration< _Rep, _Period > &  _Rel_time 
)
inline
77  { // wait for duration
78  stdext::threads::xtime _Tgt = _To_xtime(_Rel_time);
79  return (wait_until(_Lck, &_Tgt));
80  }
xtime _To_xtime(const chrono::duration< _Rep, _Period > &_Rel_time)
Definition: chrono:1014
struct xtime xtime
_Cv_status wait_until(_Lock &_Lck, const chrono::time_point< _Clock, _Duration > &_Abs_time)
Definition: condition_variable:100
template<class _Lock , class _Rep , class _Period , class _Predicate >
bool condition_variable_any::wait_for ( _Lock &  _Lck,
const chrono::duration< _Rep, _Period > &  _Rel_time,
_Predicate  _Pred 
)
inline
90  { // wait for signal with timeout and check predicate
91  while (!_Pred())
92  if (wait_for(_Lck, _Rel_time) == cv_status::timeout)
93  return (_Pred());
94  return (true);
95  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Cv_status wait_for(_Lock &_Lck, const chrono::duration< _Rep, _Period > &_Rel_time)
Definition: condition_variable:74
template<class _Lock , class _Clock , class _Duration >
_Cv_status condition_variable_any::wait_until ( _Lock &  _Lck,
const chrono::time_point< _Clock, _Duration > &  _Abs_time 
)
inline
103  { // wait until time point
105  _Rel_time = _Abs_time - _Clock::now();
106  return (wait_for(_Lck, _Rel_time));
107  }
_Cv_status wait_for(_Lock &_Lck, const chrono::duration< _Rep, _Period > &_Rel_time)
Definition: condition_variable:74
_Duration duration
Definition: chrono:230
template<class _Lock , class _Clock , class _Duration , class _Predicate >
bool condition_variable_any::wait_until ( _Lock &  _Lck,
const chrono::time_point< _Clock, _Duration > &  _Abs_time,
_Predicate  _Pred 
)
inline
117  { // wait for signal with timeout and check predicate
118  while (!_Pred())
119  if (wait_until(_Lck, _Abs_time) == cv_status::timeout)
120  return (_Pred());
121  return (true);
122  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Cv_status wait_until(_Lock &_Lck, const chrono::time_point< _Clock, _Duration > &_Abs_time)
Definition: condition_variable:100
template<class _Mutex >
_Cv_status condition_variable_any::wait_until ( _Mutex &  _Xtrnl,
const xtime _Abs_time 
)
inline
128  { // wait for signal with timeout
129  shared_ptr<mutex> _Ptr = _Myptr; // immune to *this destruction
130  _Ptr->lock();
131  _Xtrnl.unlock();
132  int _Res = _Cnd_timedwaitX(_Mycnd(),
133  _Ptr->_Mymtx(), _Abs_time);
134  _Ptr->unlock();
135  _Xtrnl.lock();
136  return (_Res == _Thrd_timedout
138  }
Definition: xthreads.h:19
void lock()
Definition: mutex:41
shared_ptr< mutex > _Myptr
Definition: condition_variable:154
_Cnd_t _Mycnd() _NOEXCEPT
Definition: condition_variable:159
int _Cnd_timedwaitX(_Cnd_t _Cnd, _Mtx_t _Mtx, const xtime *_Xt)
Definition: xthread:98
void unlock()
Definition: mutex:51
template<class _Mutex , class _Predicate >
bool condition_variable_any::wait_until ( _Mutex &  _Xtrnl,
const xtime _Abs_time,
_Predicate  _Pred 
)
inline
146  { // wait for signal with timeout and check predicate
147  while (!_Pred())
148  if (wait_until(_Xtrnl, _Abs_time) == cv_status::timeout)
149  return (_Pred());
150  return (true);
151  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Cv_status wait_until(_Lock &_Lck, const chrono::time_point< _Clock, _Duration > &_Abs_time)
Definition: condition_variable:100

Member Data Documentation

aligned_storage<_Cnd_internal_imp_size, _Cnd_internal_imp_alignment>::type condition_variable_any::_Cnd_storage
private
shared_ptr<mutex> condition_variable_any::_Myptr
private

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