UCommon
Public Member Functions
ucommon::ThreadLock::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.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Definition at line 616 of file thread.h.


Constructor & Destructor Documentation

ucommon::ThreadLock::gaurd_writer::gaurd_writer ( )

Create an unitialized instance of gaurd.

Usually used with a gaurd = operator.

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

Construct a gaurd for a specific object.

Parameters:
objectto gaurd.

Member Function Documentation

void ucommon::ThreadLock::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 656 of file thread.h.

void ucommon::ThreadLock::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: