cpp-pthread
(v1.7.3)
Simple C++ wrapper to pthread functions.
|
#include <read_write_lock.hpp>
Public Member Functions | |
void | lock () |
void | try_lock () |
void | unlock () |
virtual | ~read_lock () |
Protected Member Functions | |
read_lock () | |
Protected Attributes | |
pthread_rwlock_t | _rwlock |
This class acquires the read lock.
This class cannot be instaiated as it's main putpose is to implement read locks. To use a read lock create either a read_write_lock or a write_lock.
Definition at line 36 of file read_write_lock.hpp.
|
virtual |
the descructor, shall destroy the read-write lock object referenced by rwlock and release any resources used by the lock.
Definition at line 60 of file read_write_lock.cpp.
|
protected |
Constructor/Desctructor
this constructor shall allocate any resources required to use the read-write lock referenced by rwlock and initializes the lock to an unlocked state. The read/write lock passes NULL attributes. This means default behavior.
read_write_lock_exception | if error conditions preventing this method to succeed. |
Definition at line 53 of file read_write_lock.cpp.
void pthread::read_lock::lock | ( | ) |
The method apply a read lock.
The calling thread acquires the write lock if no other thread (reader or writer) holds the read-write lock. 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).
Definition at line 32 of file read_write_lock.cpp.
void pthread::read_lock::try_lock | ( | ) |
The method shall apply a read lock, if any thread currently holds the lock (for reading or writing) the method throws an exception.
Definition at line 39 of file read_write_lock.cpp.
void pthread::read_lock::unlock | ( | ) |
release the read lock.
read_write_lock_exception | if error conditions preventing this method to succeed. |
Definition at line 46 of file read_write_lock.cpp.
|
protected |
read/write lock reference
Definition at line 77 of file read_write_lock.hpp.