STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
stdext::threads::_Lock_base< _Mutex > Class Template Reference

Public Types

typedef _Lock_base< _Mutex > _Myt
 
typedef _Mutex _My_mtx
 

Public Member Functions

 _Lock_base (_My_mtx &_Mx)
 
 ~_Lock_base () _NOEXCEPT
 
 operator const void * () const
 
bool locked () const
 
void lock ()
 
void unlock ()
 
bool try_lock ()
 
bool timed_lock (const xtime &_Xt)
 

Private Member Functions

 _Lock_base (const _Myt &)
 
_Mytoperator= (const _Myt &)
 

Private Attributes

_My_mtx_Mtx
 
bool _Is_locked
 

Friends

class condition
 

Member Typedef Documentation

template<class _Mutex >
typedef _Mutex stdext::threads::_Lock_base< _Mutex >::_My_mtx
template<class _Mutex >
typedef _Lock_base<_Mutex> stdext::threads::_Lock_base< _Mutex >::_Myt

Constructor & Destructor Documentation

template<class _Mutex >
stdext::threads::_Lock_base< _Mutex >::_Lock_base ( _My_mtx _Mx)
inline
29  : _Is_locked(false), _Mtx(_Mx)
30  { // construct
31  }
_My_mtx & _Mtx
Definition: xmutex:91
bool _Is_locked
Definition: xmutex:92
template<class _Mutex >
stdext::threads::_Lock_base< _Mutex >::~_Lock_base ( )
inline
34  { // destroy
35  if (locked())
36  unlock();
37  }
bool locked() const
Definition: xmutex:44
void unlock()
Definition: xmutex:56
template<class _Mutex >
stdext::threads::_Lock_base< _Mutex >::_Lock_base ( const _Myt )
private

Member Function Documentation

template<class _Mutex >
void stdext::threads::_Lock_base< _Mutex >::lock ( )
inline
50  { // lock the mutex
51  if (_Is_locked || _Mtx.lock() != _Thrd_success)
53  _Is_locked = true;
54  }
_My_mtx & _Mtx
Definition: xmutex:91
bool _Is_locked
Definition: xmutex:92
Definition: xthreads.h:17
_CRTIMP2_PURE void __cdecl _Throw_lock_error()
template<class _Mutex >
bool stdext::threads::_Lock_base< _Mutex >::locked ( ) const
inline
45  { // test if locked
46  return (_Is_locked);
47  }
bool _Is_locked
Definition: xmutex:92
template<class _Mutex >
stdext::threads::_Lock_base< _Mutex >::operator const void * ( ) const
inline
40  { // test if locked
41  return (_Is_locked ? this : 0);
42  }
bool _Is_locked
Definition: xmutex:92
template<class _Mutex >
_Myt& stdext::threads::_Lock_base< _Mutex >::operator= ( const _Myt )
private
template<class _Mutex >
bool stdext::threads::_Lock_base< _Mutex >::timed_lock ( const xtime _Xt)
inline
77  { // lock the mutex with timeout
78  int _Res;
79  if (_Is_locked)
80  _Res = _Thrd_busy;
81  else if ((_Res = _Mtx.timed_lock(_Xt)) != _Thrd_success
82  && _Res != _Thrd_timedout)
84  else
85  _Is_locked = _Res == _Thrd_success;
86  return (_Is_locked);
87  }
_My_mtx & _Mtx
Definition: xmutex:91
bool _Is_locked
Definition: xmutex:92
Definition: xthreads.h:17
Definition: xthreads.h:20
Definition: xthreads.h:19
_CRTIMP2_PURE void __cdecl _Throw_lock_error()
template<class _Mutex >
bool stdext::threads::_Lock_base< _Mutex >::try_lock ( )
inline
64  { // lock the mutex if not locked
65  int _Res;
66  if (_Is_locked)
67  _Res = _Thrd_busy;
68  else if ((_Res = _Mtx.try_lock()) != _Thrd_success
69  && _Res != _Thrd_busy)
71  else
72  _Is_locked = _Res == _Thrd_success;
73  return (_Is_locked);
74  }
_My_mtx & _Mtx
Definition: xmutex:91
bool _Is_locked
Definition: xmutex:92
Definition: xthreads.h:17
Definition: xthreads.h:20
_CRTIMP2_PURE void __cdecl _Throw_lock_error()
template<class _Mutex >
void stdext::threads::_Lock_base< _Mutex >::unlock ( )
inline
57  { // unlock the mutex
58  if (!_Is_locked || _Mtx.unlock() != _Thrd_success)
60  _Is_locked = false;
61  }
_My_mtx & _Mtx
Definition: xmutex:91
bool _Is_locked
Definition: xmutex:92
Definition: xthreads.h:17
_CRTIMP2_PURE void __cdecl _Throw_lock_error()

Friends And Related Function Documentation

template<class _Mutex >
friend class condition
friend

Member Data Documentation

template<class _Mutex >
bool stdext::threads::_Lock_base< _Mutex >::_Is_locked
private
template<class _Mutex >
_My_mtx& stdext::threads::_Lock_base< _Mutex >::_Mtx
private

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