Apply automatic scope based access locking to objects.
More...
#include <thread.h>
|
void | operator= (const void *pointer) |
| Set guard to read lock a new object. More...
|
|
| reader () |
| Create an unitialized instance of guard. More...
|
|
| reader (const void *object) |
| Construct a guard for a specific object. More...
|
|
void | release (void) |
| Prematurely release a guard.
|
|
void | set (const void *object) |
| Set guard to mutex lock a new object. More...
|
|
| ~reader () |
| Release mutex when guard falls out of scope.
|
|
|
static bool | lock (const void *object, timeout_t timeout=Timer::inf) |
| Shared access to an arbitrary object. More...
|
|
Apply automatic 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.
- Author
- David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org
Definition at line 112 of file thread.h.
◆ reader() [1/2]
ucommon::RWLock::reader::reader |
( |
| ) |
|
Create an unitialized instance of guard.
Usually used with a guard = operator.
◆ reader() [2/2]
ucommon::RWLock::reader::reader |
( |
const void * |
object | ) |
|
Construct a guard for a specific object.
- Parameters
-
◆ lock()
static bool ucommon::RWLock::reader::lock |
( |
const void * |
object, |
|
|
timeout_t |
timeout = Timer::inf |
|
) |
| |
|
static |
Shared access to an arbitrary object.
This is based on the protect function of mutex.
- Parameters
-
object | to share. |
timeout | in milliseconds to wait for lock. |
- Returns
- true if shared, false if timeout.
◆ operator=()
void ucommon::RWLock::reader::operator= |
( |
const void * |
pointer | ) |
|
|
inline |
Set guard to read lock a new object.
If a lock is currently held, it is released.
- Parameters
-
pointer | to object to guard. |
Definition at line 154 of file thread.h.
◆ set()
void ucommon::RWLock::reader::set |
( |
const void * |
object | ) |
|
Set guard to mutex lock a new object.
If a lock is currently held, it is released.
- Parameters
-
The documentation for this class was generated from the following file: