Gaurd class to apply scope based exclusive locking to objects. More...
#include <thread.h>
Public Member Functions | |
gaurd_writer (void *object) | |
Construct a gaurd for a specific object. | |
gaurd_writer () | |
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_writer () | |
Release mutex when gaurd falls out of scope. |
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.
Definition at line 616 of file thread.h.
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.
object | to gaurd. |
void ucommon::ThreadLock::gaurd_writer::operator= | ( | void * | pointer | ) | [inline] |
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.
object | to gaurd. |