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
685  : _My_locked(0)
686  { // default construct
687  }
unsigned int _My_locked
Definition: mutex:756
timed_mutex::timed_mutex ( const timed_mutex )
delete

Member Function Documentation

template<class _Time >
bool timed_mutex::_Try_lock_until ( _Time  _Abs_time)
inline
731  { // try to lock the mutex with timeout
733  if (!_My_cond.wait_until(_Lock, _Abs_time,
734  [this] { return (_My_locked == 0); }))
735  return (false);
737  return (true);
738  }
unsigned int _My_locked
Definition: mutex:756
Definition: mutex:258
#define UINT_MAX
Definition: limits.h:36
mutex _My_mutex
Definition: mutex:754
condition_variable _My_cond
Definition: mutex:755
_Cv_status wait_until(unique_lock< mutex > &_Lck, const chrono::time_point< _Clock, _Duration > &_Abs_time)
Definition: mutex:599
void timed_mutex::lock ( )
inline
693  { // lock the mutex
695  while (_My_locked != 0)
696  _My_cond.wait(_Lock);
698  }
unsigned int _My_locked
Definition: mutex:756
Definition: mutex:258
#define UINT_MAX
Definition: limits.h:36
mutex _My_mutex
Definition: mutex:754
condition_variable _My_cond
Definition: mutex:755
void wait(unique_lock< mutex > &_Lck)
Definition: mutex:563
timed_mutex& timed_mutex::operator= ( const timed_mutex )
delete
bool timed_mutex::try_lock ( )
inline
701  { // try to lock the mutex
703  if (_My_locked != 0)
704  return (false);
705  else
706  {
708  return (true);
709  }
710  }
unsigned int _My_locked
Definition: mutex:756
#define UINT_MAX
Definition: limits.h:36
mutex _My_mutex
Definition: mutex:754
Definition: mutex:182
template<class _Rep , class _Period >
bool timed_mutex::try_lock_for ( const chrono::duration< _Rep, _Period > &  _Rel_time)
inline
725  { // try to lock for duration
726  return (try_lock_until(chrono::steady_clock::now() + _Rel_time));
727  }
static time_point now() _NOEXCEPT
Definition: chrono:997
bool try_lock_until(const chrono::time_point< _Clock, _Duration > &_Abs_time)
Definition: mutex:742
template<class _Clock , class _Duration >
bool timed_mutex::try_lock_until ( const chrono::time_point< _Clock, _Duration > &  _Abs_time)
inline
744  { // try to lock the mutex with timeout
745  return (_Try_lock_until(_Abs_time));
746  }
bool _Try_lock_until(_Time _Abs_time)
Definition: mutex:730
bool timed_mutex::try_lock_until ( const xtime _Abs_time)
inline
749  { // try to lock the mutex with timeout
750  return (_Try_lock_until(_Abs_time));
751  }
bool _Try_lock_until(_Time _Abs_time)
Definition: mutex:730
void timed_mutex::unlock ( )
inline
713  { // unlock the mutex
714  {
715  // The lock here is necessary
717  _My_locked = 0;
718  }
720  }
void notify_one() _NOEXCEPT
Definition: mutex:553
unsigned int _My_locked
Definition: mutex:756
mutex _My_mutex
Definition: mutex:754
Definition: mutex:182
condition_variable _My_cond
Definition: mutex:755

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: