Public Member Functions | Protected Attributes

Threads::MutexLocker Class Reference

Is an object that is convenient to use when a mutex should be locked and unlocked automaticly when returning. More...

List of all members.

Public Member Functions

 MutexLocker (Mutex &mutex, bool wait=true)
 ~MutexLocker ()
bool isLocked () const
void unLock ()
void lock ()

Protected Attributes

Mutexmutex_
bool islocked_

Detailed Description

Is an object that is convenient to use when a mutex should be locked and unlocked automaticly when returning.

Example:

int function() { MutexLocker lock( myMutex ); Do whatever you want to do }


Constructor & Destructor Documentation

Threads::MutexLocker::MutexLocker ( Mutex mutex,
bool  wait = true 
)
Threads::MutexLocker::~MutexLocker (  ) 

Member Function Documentation

bool Threads::MutexLocker::isLocked (  )  const
void Threads::MutexLocker::lock (  ) 

Use at own risk! To be safe, it should only be called by the process that created the lock, and have called the unLock().

void Threads::MutexLocker::unLock (  ) 

Use at own risk! To be safe, it should only be called by the process that created the lock.


Member Data Documentation