#include <bslmt_rwmutex.h>
This class is a platform-independent interface to a reader-writer lock ("RW mutex"). Multiple readers can safely hold the lock simultaneously, whereas only one writer is allowed to hold the lock at a time. This class uses the most efficient RW mutex implementation available for the current platform. Note that the implementation may allow readers to starve writers.
See bslmt_rwmutex
◆ RWMutex()
bslmt::RWMutex::RWMutex |
( |
| ) |
|
|
inline |
◆ ~RWMutex()
bslmt::RWMutex::~RWMutex |
( |
| ) |
|
|
inline |
Destroy this RW mutex. The behavior is undefined if the mutex is in a locked state.
◆ lockRead()
void bslmt::RWMutex::lockRead |
( |
| ) |
|
|
inline |
Lock this reader-writer mutex for reading. If there are no active or pending write locks, lock this mutex for reading and return immediately. Otherwise, block until the read lock on this mutex is acquired. Use unlock
to release the lock on this mutex. The behavior is undefined if this method is called from a thread that already has a lock on this mutex.
◆ lockWrite()
void bslmt::RWMutex::lockWrite |
( |
| ) |
|
|
inline |
Lock this reader-writer mutex for writing. If there are no active or pending locks on this mutex, lock this mutex for writing and return immediately. Otherwise, block until the write lock on this mutex is acquired. Use unlock
to release the lock on this mutex. The behavior is undefined if this method is called from a thread that already has a lock on this mutex.
◆ tryLockRead()
int bslmt::RWMutex::tryLockRead |
( |
| ) |
|
|
inline |
Attempt to lock this reader-writer mutex for reading. Immediately return 0 on success, and a non-zero value if there are active or pending writers. If successful, unlock
must be used to release the lock on this mutex. The behavior is undefined if this method is called from a thread that already has a lock on this mutex.
◆ tryLockWrite()
int bslmt::RWMutex::tryLockWrite |
( |
| ) |
|
|
inline |
Attempt to lock this reader-writer mutex for writing. Immediately return 0 on success, and a non-zero value if there are active or pending locks on this mutex. If successful, unlock
must be used to release the lock on this mutex. The behavior is undefined if this method is called from a thread that already has a lock on this mutex.
◆ unlock()
void bslmt::RWMutex::unlock |
( |
| ) |
|
|
inline |
Release the lock that the calling thread holds on this reader-writer mutex. The behavior is undefined unless the calling thread currently has a lock on this mutex.
The documentation for this class was generated from the following file: