ucommon

rwlock::gaurd_writer Class Reference

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

#include <thread.h>

Public Member Functions

 gaurd_writer ()
 Create an unitialized instance of gaurd.
 gaurd_writer (void *object)
 Construct a gaurd for a specific object.
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_writer ()
 Release mutex when gaurd falls out of scope.

Detailed Description

Gaurd class to apply scope based exclusive locking to objects.

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

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 607 of file thread.h.


Constructor & Destructor Documentation

rwlock::gaurd_writer::gaurd_writer ( )

Create an unitialized instance of gaurd.

Usually used with a gaurd = operator.

rwlock::gaurd_writer::gaurd_writer ( void *  object)

Construct a gaurd for a specific object.

Parameters:
objectto gaurd.

Member Function Documentation

void rwlock::gaurd_writer::operator= ( void *  pointer) [inline]

Set gaurd to read lock a new object.

If a lock is currently held, it is released.

Parameters:
pointerto object to gaurd.

Definition at line 647 of file thread.h.

void rwlock::gaurd_writer::set ( void *  object)

Set gaurd to mutex lock a new object.

If a lock is currently held, it is released.

Parameters:
objectto gaurd.

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