ucommon::Mutex::guard Class Reference

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

#include <thread.h>

Public Member Functions

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

Detailed Description

Guard 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 guard object falls out of scope. This is essentially an automation mechanism for mutex::protect.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 935 of file thread.h.


Constructor & Destructor Documentation

ucommon::Mutex::guard::guard (  ) 

Create an unitialized instance of guard.

Usually used with a guard = operator.

ucommon::Mutex::guard::guard ( const void *  object  ) 

Construct a guard for a specific object.

Parameters:
object to guard.

Member Function Documentation

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

Set guard to mutex lock a new object.

If a lock is currently held, it is released.

Parameters:
pointer to object to guard.

Definition at line 975 of file thread.h.

void ucommon::Mutex::guard::set ( const void *  object  ) 

Set guard to mutex lock a new object.

If a lock is currently held, it is released.

Parameters:
object to guard.

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

Generated on 30 Jul 2013 for UCommon by  doxygen 1.6.1