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

Public Member Functions

 timed_mutex () _NOEXCEPT
 
 timed_mutex (const timed_mutex &)=delete
 
timed_mutexoperator= (const timed_mutex &)=delete
 
void lock ()
 
bool try_lock () _NOEXCEPT
 
void unlock ()
 
template<class _Rep , class _Period >
bool try_lock_for (const chrono::duration< _Rep, _Period > &_Rel_time)
 
template<class _Time >
bool _Try_lock_until (_Time _Abs_time)
 
template<class _Clock , class _Duration >
bool try_lock_until (const chrono::time_point< _Clock, _Duration > &_Abs_time)
 
bool try_lock_until (const xtime *_Abs_time)
 

Private Attributes

mutex _My_mutex
 
condition_variable _My_cond
 
unsigned int _My_locked
 

Constructor & Destructor Documentation

timed_mutex::timed_mutex ( )
inline
689  : _My_locked(0)
690  { // default construct
691  }
unsigned int _My_locked
Definition: mutex:760
timed_mutex::timed_mutex ( const timed_mutex )
delete

Member Function Documentation

template<class _Time >
bool timed_mutex::_Try_lock_until ( _Time  _Abs_time)
inline
735  { // try to lock the mutex with timeout
737  if (!_My_cond.wait_until(_Lock, _Abs_time,
738  [this] { return (_My_locked == 0); }))
739  return (false);
741  return (true);
742  }
unsigned int _My_locked
Definition: mutex:760
Definition: mutex:259
#define UINT_MAX
Definition: limits.h:36
mutex _My_mutex
Definition: mutex:758
condition_variable _My_cond
Definition: mutex:759
_Cv_status wait_until(unique_lock< mutex > &_Lck, const chrono::time_point< _Clock, _Duration > &_Abs_time)
Definition: mutex:601
void timed_mutex::lock ( )
inline
697  { // lock the mutex
699  while (_My_locked != 0)
700  _My_cond.wait(_Lock);
702  }
unsigned int _My_locked
Definition: mutex:760
Definition: mutex:259
#define UINT_MAX
Definition: limits.h:36
mutex _My_mutex
Definition: mutex:758
condition_variable _My_cond
Definition: mutex:759
void wait(unique_lock< mutex > &_Lck)
Definition: mutex:564
timed_mutex& timed_mutex::operator= ( const timed_mutex )
delete
bool timed_mutex::try_lock ( )
inline
705  { // try to lock the mutex
707  if (_My_locked != 0)
708  return (false);
709  else
710  {
712  return (true);
713  }
714  }
unsigned int _My_locked
Definition: mutex:760
#define UINT_MAX
Definition: limits.h:36
mutex _My_mutex
Definition: mutex:758
Definition: mutex:183
template<class _Rep , class _Period >
bool timed_mutex::try_lock_for ( const chrono::duration< _Rep, _Period > &  _Rel_time)
inline
729  { // try to lock for duration
730  return (try_lock_until(chrono::steady_clock::now() + _Rel_time));
731  }
static time_point now() _NOEXCEPT
Definition: chrono:1001
bool try_lock_until(const chrono::time_point< _Clock, _Duration > &_Abs_time)
Definition: mutex:746
template<class _Clock , class _Duration >
bool timed_mutex::try_lock_until ( const chrono::time_point< _Clock, _Duration > &  _Abs_time)
inline
748  { // try to lock the mutex with timeout
749  return (_Try_lock_until(_Abs_time));
750  }
bool _Try_lock_until(_Time _Abs_time)
Definition: mutex:734
bool timed_mutex::try_lock_until ( const xtime _Abs_time)
inline
753  { // try to lock the mutex with timeout
754  return (_Try_lock_until(_Abs_time));
755  }
bool _Try_lock_until(_Time _Abs_time)
Definition: mutex:734
void timed_mutex::unlock ( )
inline
717  { // unlock the mutex
718  {
719  // The lock here is necessary
721  _My_locked = 0;
722  }
724  }
void notify_one() _NOEXCEPT
Definition: mutex:554
unsigned int _My_locked
Definition: mutex:760
mutex _My_mutex
Definition: mutex:758
Definition: mutex:183
condition_variable _My_cond
Definition: mutex:759

Member Data Documentation

condition_variable timed_mutex::_My_cond
private
unsigned int timed_mutex::_My_locked
private
mutex timed_mutex::_My_mutex
private

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