STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Private 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)
 
template<class _Predicate >
bool _Wait_until1 (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 Member Functions

_Cnd_t _Mycnd () _NOEXCEPT
 

Private Attributes

aligned_storage< _Cnd_internal_imp_size, _Cnd_internal_imp_alignment >::type _Cnd_storage
 

Member Typedef Documentation

Constructor & Destructor Documentation

condition_variable::condition_variable ( )
inline
541  { // construct
543  }
_CRTIMP2_PURE void __cdecl _Cnd_init_in_situ(_Cnd_t)
_Cnd_t _Mycnd() _NOEXCEPT
Definition: mutex:675
condition_variable::~condition_variable ( )
inline
546  { // destroy
548  }
_Cnd_t _Mycnd() _NOEXCEPT
Definition: mutex:675
_CRTIMP2_PURE void __cdecl _Cnd_destroy_in_situ(_Cnd_t)
condition_variable::condition_variable ( const condition_variable )
delete

Member Function Documentation

_Cnd_t condition_variable::_Mycnd ( )
inlineprivate
676  { // get pointer to _Cnd_internal_imp_t inside _Cnd_storage
677  return (reinterpret_cast<_Cnd_t>(&_Cnd_storage));
678  }
aligned_storage< _Cnd_internal_imp_size, _Cnd_internal_imp_alignment >::type _Cnd_storage
Definition: mutex:673
void condition_variable::_Register ( unique_lock< mutex > &  _Lck,
int *  _Ready 
)
inline
661  { // register this object for release at thread exit
663  _Lck.release()->_Mymtx(), _Ready);
664  }
_CRTIMP2_PURE void __cdecl _Cnd_register_at_thread_exit(_Cnd_t, _Mtx_t, int *)
_Cnd_t _Mycnd() _NOEXCEPT
Definition: mutex:675
_Mutex * release() _NOEXCEPT
Definition: mutex:402
void condition_variable::_Unregister ( mutex _Mtx)
inline
667  { // unregister this object for release at thread exit
668  _Cnd_unregister_at_thread_exit(_Mtx._Mymtx());
669  }
_CRTIMP2_PURE void __cdecl _Cnd_unregister_at_thread_exit(_Mtx_t)
template<class _Predicate >
bool condition_variable::_Wait_until1 ( unique_lock< mutex > &  _Lck,
const xtime _Abs_time,
_Predicate &  _Pred 
)
inline
648  { // wait for signal with timeout and check predicate
649  while (!_Pred())
650  if (wait_until(_Lck, _Abs_time) == cv_status::timeout)
651  return (_Pred());
652  return (true);
653  }
_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: mutex:599
native_handle_type condition_variable::native_handle ( )
inline
656  { // return condition variable handle
657  return (_Mycnd());
658  }
_Cnd_t _Mycnd() _NOEXCEPT
Definition: mutex:675
void condition_variable::notify_all ( )
inline
559  { // wake up all waiters
561  }
int _Cnd_broadcastX(_Cnd_t _Cnd)
Definition: xthread:104
_Cnd_t _Mycnd() _NOEXCEPT
Definition: mutex:675
void condition_variable::notify_one ( )
inline
554  { // wake up one waiter
555  _Cnd_signalX(_Mycnd());
556  }
_Cnd_t _Mycnd() _NOEXCEPT
Definition: mutex:675
int _Cnd_signalX(_Cnd_t _Cnd)
Definition: xthread:109
condition_variable& condition_variable::operator= ( const condition_variable )
delete
void condition_variable::wait ( unique_lock< mutex > &  _Lck)
inline
564  { // wait for signal
565  _Cnd_waitX(_Mycnd(), _Lck.mutex()->_Mymtx());
566  }
_Cnd_t _Mycnd() _NOEXCEPT
Definition: mutex:675
_Mutex * mutex() const _NOEXCEPT
Definition: mutex:421
int _Cnd_waitX(_Cnd_t _Cnd, _Mtx_t _Mtx)
Definition: xthread:93
template<class _Predicate >
void condition_variable::wait ( unique_lock< mutex > &  _Lck,
_Predicate  _Pred 
)
inline
570  { // wait for signal and test predicate
571  while (!_Pred())
572  wait(_Lck);
573  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
void wait(unique_lock< mutex > &_Lck)
Definition: mutex:563
template<class _Rep , class _Period >
_Cv_status condition_variable::wait_for ( unique_lock< mutex > &  _Lck,
const chrono::duration< _Rep, _Period > &  _Rel_time 
)
inline
580  { // wait for duration
581  _STDEXT threads::xtime _Tgt = _To_xtime(_Rel_time);
582  return (wait_until(_Lck, &_Tgt));
583  }
xtime _To_xtime(const chrono::duration< _Rep, _Period > &_Rel_time)
Definition: chrono:1014
struct xtime xtime
_Cv_status wait_until(unique_lock< mutex > &_Lck, const chrono::time_point< _Clock, _Duration > &_Abs_time)
Definition: mutex:599
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
592  { // wait for signal with timeout and check predicate
593  _STDEXT threads::xtime _Tgt = _To_xtime(_Rel_time);
594  return (_Wait_until1(_Lck, &_Tgt, _Pred));
595  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
xtime _To_xtime(const chrono::duration< _Rep, _Period > &_Rel_time)
Definition: chrono:1014
struct xtime xtime
bool _Wait_until1(unique_lock< mutex > &_Lck, const xtime *_Abs_time, _Predicate &_Pred)
Definition: mutex:644
template<class _Clock , class _Duration >
_Cv_status condition_variable::wait_until ( unique_lock< mutex > &  _Lck,
const chrono::time_point< _Clock, _Duration > &  _Abs_time 
)
inline
602  { // wait until time point
604  _Rel_time = _Abs_time - _Clock::now();
605  return (wait_for(_Lck, _Rel_time));
606  }
_Cv_status wait_for(unique_lock< mutex > &_Lck, const chrono::duration< _Rep, _Period > &_Rel_time)
Definition: mutex:577
_Duration duration
Definition: chrono:230
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
615  { // wait for signal with timeout and check predicate
617  _Rel_time = _Abs_time - _Clock::now();
618  _STDEXT threads::xtime _Tgt = _To_xtime(_Rel_time);
619  return (_Wait_until1(_Lck, &_Tgt, _Pred));
620  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
xtime _To_xtime(const chrono::duration< _Rep, _Period > &_Rel_time)
Definition: chrono:1014
struct xtime xtime
bool _Wait_until1(unique_lock< mutex > &_Lck, const xtime *_Abs_time, _Predicate &_Pred)
Definition: mutex:644
_Duration duration
Definition: chrono:230
_Cv_status condition_variable::wait_until ( unique_lock< mutex > &  _Lck,
const xtime _Abs_time 
)
inline
625  { // wait for signal with timeout
626  if (!_Mtx_current_owns(_Lck.mutex()->_Mymtx()))
628  int _Res = _Cnd_timedwaitX(_Mycnd(),
629  _Lck.mutex()->_Mymtx(), _Abs_time);
630  return (_Res == _Thrd_timedout
632  }
Definition: xthreads.h:19
_Cnd_t _Mycnd() _NOEXCEPT
Definition: mutex:675
int _Cnd_timedwaitX(_Cnd_t _Cnd, _Mtx_t _Mtx, const xtime *_Xt)
Definition: xthread:98
_Mutex * mutex() const _NOEXCEPT
Definition: mutex:421
_CRTIMP2_PURE int __cdecl _Mtx_current_owns(_Mtx_t)
Definition: xthread:24
_CRTIMP2_PURE void __cdecl _Throw_Cpp_error(int _Code)
template<class _Predicate >
bool condition_variable::wait_until ( unique_lock< mutex > &  _Lck,
const xtime _Abs_time,
_Predicate  _Pred 
)
inline
639  { // wait for signal with timeout and check predicate
640  return (_Wait_until1(_Lck, _Abs_time, _Pred));
641  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
bool _Wait_until1(unique_lock< mutex > &_Lck, const xtime *_Abs_time, _Predicate &_Pred)
Definition: mutex:644

Member Data Documentation

aligned_storage<_Cnd_internal_imp_size, _Cnd_internal_imp_alignment>::type condition_variable::_Cnd_storage
private

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