|
CARMA C++
|
A simple wrapper class that makes use of ::pthread_rwlock_t easier in a C++ world. More...
#include <carma/util/PthreadRWLock.h>
Public Member Functions | |
| void | ExclusiveLock () |
| Obtain an exclusive lock on the instance for the caller's thread. More... | |
| void | ExclusiveUnlock () |
| Release an exclusive lock on the instance for the caller's thread. More... | |
| const ::pthread_rwlock_t & | InternalPthreadRWLock () const |
| Obtain a reference to the internal ::pthread_rwlock_t. More... | |
| ::pthread_rwlock_t & | InternalPthreadRWLock () |
| Obtain a reference to the internal ::pthread_rwlock_t. More... | |
| PthreadRWLock () | |
| Construct a read/write lock with the CARMA defaults. More... | |
| PthreadRWLock (const PthreadRWLockAttr &attr) | |
| Construct a read/write lock with the given attributes. More... | |
| PthreadRWLock (const ::pthread_rwlockattr_t &attr) | |
| Construct a read/write lock with the given attributes. More... | |
| void | SharedLock () |
| Obtain an shared lock on the instance for the caller's thread. More... | |
| void | SharedUnlock () |
| Release a shared lock on the instance for the caller's thread. More... | |
| bool | TryExclusiveLock () |
| Try to obtain an exclusive lock on the instance for the caller's thread. More... | |
| bool | TrySharedLock () |
| Try to obtain a shared lock on the instance for the caller's thread. More... | |
| virtual | ~PthreadRWLock () |
| Destruct a read/write lock. More... | |
A simple wrapper class that makes use of ::pthread_rwlock_t easier in a C++ world.
If you have no idea what a read/write lock is then here is the general idea: It is used to serialize manipulation/access to some shared resource from multiple threads. Hence, methods of PthreadRWLock are safe to call concurrently on a single instance. They wouldn't be terribly useful if this wasn't the case.
Definition at line 46 of file PthreadRWLock.h.
|
explicit |
Construct a read/write lock with the CARMA defaults.
Any internal errors will throw an exception.
|
explicit |
Construct a read/write lock with the given attributes.
Any internal errors will throw an exception.
|
explicit |
Construct a read/write lock with the given attributes.
Any internal errors will throw an exception.
|
virtual |
Destruct a read/write lock.
No exceptions will be thrown and hence internal errors will be ignored as far as clients are concerned (though they may be logged).
| void carma::util::PthreadRWLock::ExclusiveLock | ( | ) |
Obtain an exclusive lock on the instance for the caller's thread.
Definition at line 241 of file PthreadRWLock.h.
| void carma::util::PthreadRWLock::ExclusiveUnlock | ( | ) |
Release an exclusive lock on the instance for the caller's thread.
Definition at line 255 of file PthreadRWLock.h.
| const ::pthread_rwlock_t & carma::util::PthreadRWLock::InternalPthreadRWLock | ( | ) | const |
Obtain a reference to the internal ::pthread_rwlock_t.
Definition at line 283 of file PthreadRWLock.h.
| pthread_rwlock_t & carma::util::PthreadRWLock::InternalPthreadRWLock | ( | ) |
Obtain a reference to the internal ::pthread_rwlock_t.
Definition at line 290 of file PthreadRWLock.h.
| void carma::util::PthreadRWLock::SharedLock | ( | ) |
Obtain an shared lock on the instance for the caller's thread.
Definition at line 262 of file PthreadRWLock.h.
| void carma::util::PthreadRWLock::SharedUnlock | ( | ) |
Release a shared lock on the instance for the caller's thread.
Definition at line 276 of file PthreadRWLock.h.
| bool carma::util::PthreadRWLock::TryExclusiveLock | ( | ) |
Try to obtain an exclusive lock on the instance for the caller's thread.
Definition at line 248 of file PthreadRWLock.h.
| bool carma::util::PthreadRWLock::TrySharedLock | ( | ) |
Try to obtain a shared lock on the instance for the caller's thread.
Definition at line 269 of file PthreadRWLock.h.