#include <LOW_thread_rwlock.h>
Inheritance diagram for LOW_thread_rwlock:
Public Member Functions | |
class_DERIVE_FROM_EXCEPTION (thread_rwlock_error, LOW_exception) | |
Exception base class for all exceptions thrown by LOW_thread_rwlock. | |
class_DERIVE_FROM_EXCEPTION (thread_rwlock_locked, thread_rwlock_error) | |
Exception class to indicate a mutex already locked by the calling thread. | |
class_DERIVE_FROM_EXCEPTION (thread_rwlock_busy, thread_rwlock_error) | |
Exception class to indicate a mutex locked by another thread. | |
virtual | ~LOW_thread_rwlock () |
Destructor. | |
virtual void | lockRead ()=0 |
Obtain a read lock on the rwlock (blocking). | |
virtual void | tryLockRead ()=0 |
Obtain a read lock on the rwlock (non-blocking). | |
virtual void | lockWrite ()=0 |
Obtain a write lock on the rwlock (blocking). | |
virtual void | tryLockWrite ()=0 |
Obtain a write lock on the rwlock (non-blocking). | |
virtual void | unlock ()=0 |
Release a lock on the rwlock. |
Each instance represents one lock.
Specific platforms dereive their implementation classes from this class.
The instances are created by LOW_thread_Factory, following the factory design pattern.
This class is thread-safe.
Parts of the documentation taken from Linux man pages by Xavier Leroy.
Parts of the documentation taken from IEEE Standard 1003.1-2003.
Definition at line 41 of file LOW_thread_rwlock.h.
|
Destructor.
Definition at line 27 of file LOW_thread_rwlock.cpp. |
|
Exception class to indicate a mutex locked by another thread.
|
|
Exception class to indicate a mutex already locked by the calling thread.
|
|
Exception base class for all exceptions thrown by LOW_thread_rwlock.
|
|
Obtain a read lock on the rwlock (blocking). The method applies a read lock to the read-write lock. The calling thread acquires the read lock if a writer does not hold the lock and there are no writers blocked on the lock. A thread may hold multiple concurrent read locks on rwlock (that is, successfully call the lockRead() method n times). If so, the application shall ensure that the thread performs matching unlocks (that is, it calls unlock() method n times).
Implemented in LOW_thread_rwlock_POSIX. Referenced by LOW_objectSynchronizer::__synchronizeMethodRead::__synchronizeMethodRead(), LOW_objectSynchronizer::__synchronizeMethodReadWeak::__synchronizeMethodReadWeak(), and LOW_thread_rwlock::rwLockRead::rwLockRead(). |
|
Obtain a write lock on the rwlock (blocking). The method applies a write lock to the read-write lock. The calling thread acquires the write lock if no other thread (reader or writer) holds the read-write lock rwlock. Otherwise, the thread will 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).
Implemented in LOW_thread_rwlock_POSIX. Referenced by LOW_objectSynchronizer::__synchronizeMethodWrite::__synchronizeMethodWrite(), LOW_objectSynchronizer::__synchronizeMethodWriteWeak::__synchronizeMethodWriteWeak(), and LOW_thread_rwlock::rwLockWrite::rwLockWrite(). |
|
Obtain a read lock on the rwlock (non-blocking). The method applies a read lock as in the lockRead() method, with the exception that the function throws an exception if the equivalent lockRead() call would have blocked the calling thread. The method never blocks; it always either acquires the lock or throws a thread_rwlock_busy exception.
Implemented in LOW_thread_rwlock_POSIX. Referenced by LOW_objectSynchronizer::__synchronizeMethodRead::__synchronizeMethodRead(), and LOW_objectSynchronizer::__synchronizeMethodReadWeak::__synchronizeMethodReadWeak(). |
|
Obtain a write lock on the rwlock (non-blocking). The method applies a write lock like the lockWrite() method, with the exception that the function throws an exception if any thread currently holds the rwlock (for reading or writing).
Implemented in LOW_thread_rwlock_POSIX. Referenced by LOW_objectSynchronizer::__synchronizeMethodWrite::__synchronizeMethodWrite(), and LOW_objectSynchronizer::__synchronizeMethodWriteWeak::__synchronizeMethodWriteWeak(). |
|
Release a lock on the rwlock. The method releasees a lock held on the read-write lock. Results are undefined if the read-write lock rwlock is not held by the calling thread. If this method is called to release a read lock from the read-write lock object and there are other read locks currently held on this read-write lock object, the read-write lock object remains in the read locked state. If this method releases the last read lock for this read-write lock object, the read-write lock object is put in the unlocked state with no owners. If this method is called to release a write lock for this read-write lock object, the read-write lock object is put in the unlocked state.
Implemented in LOW_thread_rwlock_POSIX. Referenced by LOW_objectSynchronizer::__synchronizeMethodRead::~__synchronizeMethodRead(), LOW_objectSynchronizer::__synchronizeMethodReadWeak::~__synchronizeMethodReadWeak(), LOW_objectSynchronizer::__synchronizeMethodWrite::~__synchronizeMethodWrite(), LOW_objectSynchronizer::__synchronizeMethodWriteWeak::~__synchronizeMethodWriteWeak(), LOW_thread_rwlock::rwLockRead::~rwLockRead(), and LOW_thread_rwlock::rwLockWrite::~rwLockWrite(). |