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

Public Member Functions

 recursive_timed_mutex () _NOEXCEPT
 
 recursive_timed_mutex (const recursive_timed_mutex &)=delete
 
recursive_timed_mutexoperator= (const recursive_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
 
thread::id _My_owner
 

Constructor & Destructor Documentation

recursive_timed_mutex::recursive_timed_mutex ( )
inline
767  : _My_locked(0)
768  { // default construct
769  }
unsigned int _My_locked
Definition: mutex:889
recursive_timed_mutex::recursive_timed_mutex ( const recursive_timed_mutex )
delete

Member Function Documentation

template<class _Time >
bool recursive_timed_mutex::_Try_lock_until ( _Time  _Abs_time)
inline
850  { // try to lock the mutex with timeout
852 
854 
855  if (_Tid == _My_owner)
856  {
857  if (_My_locked < UINT_MAX)
858  ++_My_locked;
859  else
860  return (false);
861  }
862  else
863  {
864  if (!_My_cond.wait_until(_Lock, _Abs_time,
865  [this] { return (_My_locked == 0); }))
866  return (false);
867  _My_locked = 1;
868  _My_owner = _Tid;
869  }
870  return (true);
871  }
condition_variable _My_cond
Definition: mutex:888
Definition: mutex:259
mutex _My_mutex
Definition: mutex:887
#define UINT_MAX
Definition: limits.h:36
thread::id _My_owner
Definition: mutex:890
unsigned int _My_locked
Definition: mutex:889
Definition: thread:148
_Cv_status wait_until(unique_lock< mutex > &_Lck, const chrono::time_point< _Clock, _Duration > &_Abs_time)
Definition: mutex:601
thread::id get_id() _NOEXCEPT
Definition: thread:203
void recursive_timed_mutex::lock ( )
inline
775  { // lock the mutex
777 
779 
780  if (_Tid == _My_owner)
781  {
782  if (_My_locked < UINT_MAX)
783  ++_My_locked;
784  else
787  }
788  else
789  {
790  while (_My_locked != 0)
791  _My_cond.wait(_Lock);
792  _My_locked = 1;
793  _My_owner = _Tid;
794  }
795  }
condition_variable _My_cond
Definition: mutex:888
Definition: mutex:259
mutex _My_mutex
Definition: mutex:887
error_code make_error_code(_Future_errc _Errno) _NOEXCEPT
Definition: future:119
Definition: system_error:526
#define UINT_MAX
Definition: limits.h:36
thread::id _My_owner
Definition: mutex:890
#define _THROW_NCEE(x, y)
Definition: xstddef:51
unsigned int _My_locked
Definition: mutex:889
void wait(unique_lock< mutex > &_Lck)
Definition: mutex:564
Definition: thread:148
thread::id get_id() _NOEXCEPT
Definition: thread:203
recursive_timed_mutex& recursive_timed_mutex::operator= ( const recursive_timed_mutex )
delete
bool recursive_timed_mutex::try_lock ( )
inline
798  { // try to lock the mutex
800 
802 
803  if (_Tid == _My_owner)
804  {
805  if (_My_locked < UINT_MAX)
806  ++_My_locked;
807  else
808  return (false);
809  }
810  else
811  {
812  if (_My_locked != 0)
813  return (false);
814  else
815  {
816  _My_locked = 1;
817  _My_owner = _Tid;
818  }
819  }
820  return (true);
821  }
mutex _My_mutex
Definition: mutex:887
#define UINT_MAX
Definition: limits.h:36
thread::id _My_owner
Definition: mutex:890
Definition: mutex:183
unsigned int _My_locked
Definition: mutex:889
Definition: thread:148
thread::id get_id() _NOEXCEPT
Definition: thread:203
template<class _Rep , class _Period >
bool recursive_timed_mutex::try_lock_for ( const chrono::duration< _Rep, _Period > &  _Rel_time)
inline
844  { // try to lock for duration
845  return (try_lock_until(chrono::steady_clock::now() + _Rel_time));
846  }
bool try_lock_until(const chrono::time_point< _Clock, _Duration > &_Abs_time)
Definition: mutex:875
static time_point now() _NOEXCEPT
Definition: chrono:1001
template<class _Clock , class _Duration >
bool recursive_timed_mutex::try_lock_until ( const chrono::time_point< _Clock, _Duration > &  _Abs_time)
inline
877  { // try to lock the mutex with timeout
878  return (_Try_lock_until(_Abs_time));
879  }
bool _Try_lock_until(_Time _Abs_time)
Definition: mutex:849
bool recursive_timed_mutex::try_lock_until ( const xtime _Abs_time)
inline
882  { // try to lock the mutex with timeout
883  return (_Try_lock_until(_Abs_time));
884  }
bool _Try_lock_until(_Time _Abs_time)
Definition: mutex:849
void recursive_timed_mutex::unlock ( )
inline
824  { // unlock the mutex
825  bool _Do_notify = false;
826 
827  {
829  --_My_locked;
830  if (_My_locked == 0)
831  {
832  _Do_notify = true;
833  _My_owner = thread::id();
834  }
835  }
836 
837  if (_Do_notify)
839  }
void notify_one() _NOEXCEPT
Definition: mutex:554
condition_variable _My_cond
Definition: mutex:888
mutex _My_mutex
Definition: mutex:887
thread::id _My_owner
Definition: mutex:890
Definition: mutex:183
unsigned int _My_locked
Definition: mutex:889
Definition: thread:148

Member Data Documentation

condition_variable recursive_timed_mutex::_My_cond
private
unsigned int recursive_timed_mutex::_My_locked
private
mutex recursive_timed_mutex::_My_mutex
private
thread::id recursive_timed_mutex::_My_owner
private

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