Inheritance diagram for smtk::rwlock:

Public Member Functions | |
| int | init (struct rwlock_struct *lock, MODE flag=GET) |
| initialize the lock | |
| bool | is_invalid (void) const |
| see if the object is invalid | |
| bool | is_valid (void) const |
| see if the object is valid | |
| int | rlock (void) |
| acquire the read lock | |
| int | runlock (void) |
| release the read lock | |
| rwlock (struct rwlock_struct *lock=0, MODE flag=GET) | |
| int | try_rlock (void) |
| try to get the read lock | |
| int | try_wlock (void) |
| try to get the write lock | |
| int | wlock (void) |
| acquire the write lock | |
| int | wunlock (void) |
| release the write lock | |
| virtual | ~rwlock (void) |
Protected Member Functions | |
| template<class T> | |
| T | invalidate (T t) |
| invalidate the object | |
| void | invalidate (void) |
| invalidate the object | |
| template<class T> | |
| T | validate (T t) |
| validate the object | |
| void | validate (void) |
| validate the object | |
This is a read-write lock wrapper. In GNU/Linux systems it wraps pthreads read-write locks. These are setup to be inter-process read-write locks, with the intent of using them to provide consistent inter-process shared memory.
| rwlock::rwlock | ( | struct rwlock_struct * | lock = 0, |
|
| MODE | flag = GET | |||
| ) |
Create a read-write lock object.
| lock | is a pointer to a user provided struct rwlock_struct. If the points to data in a shared memory file than this lock may be shared between processes. If lock=0 you can call conditional::init() later to initialize this object. | |
| flag | If flag is GET then the read-write lock will be created if it does not exist, else if flag is CONNECT than the read-write lock must exist before this call, or else if flag is CREATE the read-write lock must not exist before this call and it will be created. |
| rwlock::~rwlock | ( | void | ) | [virtual] |
virtual destructor
| int rwlock::init | ( | struct rwlock_struct * | lock, | |
| MODE | flag = GET | |||
| ) |
initialize the lock
This will work the same as the constructor.
This may be used to reuse an old object with a new read-write lock. Do not call this if this object is not in a call to rlock(), wlock() try_rlock(), or try_wlock(), as could be the case in a signal catcher or other jumping function call.
| lock | is a pointer to a user provided struct rwlock_struct. If the points to data in a shared memory file than this lock may be shared between processes. | |
| flag | If flag is GET then the read-write lock will be created if it does not exist, else if flag is CONNECT than the read-write lock must exist before this call, or else if flag is CREATE the read-write lock must not exist before this call and it will be created. |
| T smtk::validation::invalidate | ( | T | t | ) | [inline, protected, inherited] |
invalidate the object
Make the object invalid.
| void smtk::validation::invalidate | ( | void | ) | [inline, protected, inherited] |
invalidate the object
Make the object invalid.
| bool smtk::validation::is_invalid | ( | void | ) | const [inline, inherited] |
see if the object is invalid
| bool smtk::validation::is_valid | ( | void | ) | const [inline, inherited] |
see if the object is valid
| int rwlock::rlock | ( | void | ) |
| int rwlock::runlock | ( | void | ) |
release the read lock
| int rwlock::try_rlock | ( | void | ) |
try to get the read lock
This will not block.
| int rwlock::try_wlock | ( | void | ) |
try to get the write lock
This will not block.
| T smtk::validation::validate | ( | T | t | ) | [inline, protected, inherited] |
validate the object
Make the object valid.
| void smtk::validation::validate | ( | void | ) | [inline, protected, inherited] |
validate the object
Make the object valid.
| int rwlock::wlock | ( | void | ) |
acquire the write lock
The wlock() method shall apply a write lock to the read-write lock referenced by object. The calling thread acquires the write lock if no other thread (or process) (reader or writer) holds the read-write lock rwlock. Otherwise, the thread shall block until it can acquire the lock. The calling thread may deadlock if at the time the call is made it holds the read-write lock (whether a read or write lock).
| int rwlock::wunlock | ( | void | ) |
release the write lock
1.5.2