ucommon
|
Guard class to apply scope based access locking to objects. More...
#include <thread.h>
Public Member Functions | |
guard_reader () | |
Create an unitialized instance of guard. More... | |
guard_reader (const void *object) | |
Construct a guard for a specific object. More... | |
void | operator= (const void *pointer) |
Set guard to read lock a new object. More... | |
void | release (void) |
Prematurely release a guard. | |
void | set (const void *object) |
Set guard to mutex lock a new object. More... | |
~guard_reader () | |
Release mutex when guard falls out of scope. | |
Guard 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 guard object falls out of scope. This is essentially an automation mechanism for mutex::reader.
ucommon::ThreadLock::guard_reader::guard_reader | ( | ) |
Create an unitialized instance of guard.
Usually used with a guard = operator.
ucommon::ThreadLock::guard_reader::guard_reader | ( | const void * | object | ) |
Construct a guard for a specific object.
object | to guard. |
|
inline |
void ucommon::ThreadLock::guard_reader::set | ( | const void * | object | ) |
Set guard to mutex lock a new object.
If a lock is currently held, it is released.
object | to guard. |