Bayonne2 / Common C++ 2 Framework
|
The ThreadLock class impliments a thread rwlock for optimal reader performance on systems which have rwlock support, and reverts to a simple mutex for those that do not. More...
#include <thread.h>
Public Member Functions | |
ThreadLock () | |
Create a process shared thread lock object. More... | |
virtual | ~ThreadLock () |
Destroy a process shared thread lock object. More... | |
void | readLock (void) |
Aquire a read lock for the current object. More... | |
void | writeLock (void) |
Aquire a write lock for the current object. More... | |
bool | tryReadLock (void) |
Attempt read lock for current object. More... | |
bool | tryWriteLock (void) |
Attempt write lock for current object. More... | |
void | unlock (void) |
Release any held locks. More... | |
Private Attributes | |
Mutex | mutex |
The ThreadLock class impliments a thread rwlock for optimal reader performance on systems which have rwlock support, and reverts to a simple mutex for those that do not.
ThreadLock::ThreadLock | ( | ) |
Create a process shared thread lock object.
|
virtual |
Destroy a process shared thread lock object.
void ThreadLock::readLock | ( | void | ) |
Aquire a read lock for the current object.
bool ThreadLock::tryReadLock | ( | void | ) |
Attempt read lock for current object.
bool ThreadLock::tryWriteLock | ( | void | ) |
Attempt write lock for current object.
void ThreadLock::unlock | ( | void | ) |
Release any held locks.
void ThreadLock::writeLock | ( | void | ) |
Aquire a write lock for the current object.