ucommon::Mutex::gaurd Class Reference

Gaurd class to apply scope based mutex locking to objects. More...

#include <thread.h>

Public Member Functions

 gaurd (void *object)
 Construct a gaurd for a specific object.
 gaurd ()
 Create an unitialized instance of gaurd.
void operator= (void *pointer)
 Set gaurd to mutex lock a new object.
void release (void)
 Prematurely release a gaurd.
void set (void *object)
 Set gaurd to mutex lock a new object.
 ~gaurd ()
 Release mutex when gaurd falls out of scope.

Detailed Description

Gaurd class to apply scope based mutex locking to objects.

The mutex is located from the mutex pool rather than contained in the target object, and the lock is released when the gaurd object falls out of scope. This is essentially an automation mechanism for mutex::protect.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 1140 of file thread.h.


Constructor & Destructor Documentation

ucommon::Mutex::gaurd::gaurd (  ) 

Create an unitialized instance of gaurd.

Usually used with a gaurd = operator.

ucommon::Mutex::gaurd::gaurd ( void *  object  ) 

Construct a gaurd for a specific object.

Parameters:
object to gaurd.

Member Function Documentation

void ucommon::Mutex::gaurd::operator= ( void *  pointer  )  [inline]

Set gaurd to mutex lock a new object.

If a lock is currently held, it is released.

Parameters:
pointer to object to gaurd.

Definition at line 1180 of file thread.h.

void ucommon::Mutex::gaurd::set ( void *  object  ) 

Set gaurd to mutex lock a new object.

If a lock is currently held, it is released.

Parameters:
object to gaurd.

The documentation for this class was generated from the following file:
Generated on Thu Jul 14 16:35:12 2011 for ucommon by  doxygen 1.6.3