Thread portable class


Gate portable class


Timer class


Pool class


Terimber 2.0


About C++


Downloads Products & Services Support Clients Open Source About



Home / Open source / Terimber 2.0

mutex_keeper Class Reference

automatic mutex locker More...

#include <primitives.h>

List of all members.

Public Member Functions

 mutex_keeper (const mutex &mtx, bool use_try=false)
 constructor
 ~mutex_keeper ()
 destructor
void unlock () const
 unlocks explicitly
void lock () const
 locks explicitly
 operator bool () const
 checks the lock state
bool operator! () const
 checks the lock state

Private Attributes

const mutex_mtx
 mutex reference
bool _locked
 lock flag for explicit unlock


Detailed Description

automatic mutex locker

Definition at line 87 of file primitives.h.


Constructor & Destructor Documentation

mutex_keeper::mutex_keeper ( const mutex mtx,
bool  use_try = false 
) [inline]

constructor

Parameters:
mtx  mutex reference
use_try  try lock or make a blocking call

Definition at line 91 of file primitives.h.

References _locked, _mtx, mutex::lock(), and mutex::trylock().

mutex_keeper::~mutex_keeper (  )  [inline]

destructor

Definition at line 98 of file primitives.h.

References _locked, _mtx, and mutex::unlock().


Member Function Documentation

mutex_keeper::operator bool (  )  const [inline]

checks the lock state

Definition at line 127 of file primitives.h.

References _locked.

bool mutex_keeper::operator! (  )  const [inline]

checks the lock state

Definition at line 134 of file primitives.h.

References _locked.


Member Data Documentation

const mutex& mutex_keeper::_mtx [private]

mutex reference

Definition at line 139 of file primitives.h.

Referenced by lock(), mutex_keeper(), unlock(), and ~mutex_keeper().

bool mutex_keeper::_locked [mutable, private]

lock flag for explicit unlock

Definition at line 140 of file primitives.h.

Referenced by lock(), mutex_keeper(), operator bool(), operator!(), unlock(), and ~mutex_keeper().


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


© Copyright Terimber 2003-.