ucommon::ThreadLock::gaurd_reader Class Reference

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

#include <thread.h>

Public Member Functions

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

Detailed Description

Gaurd class to apply scope based access locking to objects.

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

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 565 of file thread.h.


Constructor & Destructor Documentation

ucommon::ThreadLock::gaurd_reader::gaurd_reader (  ) 

Create an unitialized instance of gaurd.

Usually used with a gaurd = operator.

ucommon::ThreadLock::gaurd_reader::gaurd_reader ( void *  object  ) 

Construct a gaurd for a specific object.

Parameters:
object to gaurd.

Member Function Documentation

void ucommon::ThreadLock::gaurd_reader::operator= ( void *  pointer  )  [inline]

Set gaurd to read lock a new object.

If a lock is currently held, it is released.

Parameters:
pointer to object to gaurd.

Definition at line 605 of file thread.h.

void ucommon::ThreadLock::gaurd_reader::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:40:09 2011 for ucommon by  doxygen 1.6.3