BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslmt::ReaderWriterMutexImpl< ATOMIC_OP, MUTEX, SEMAPHORE > Class Template Reference

#include <bslmt_readerwritermuteximpl.h>

Public Member Functions

 ReaderWriterMutexImpl ()
 Construct a reader/writer lock initialized to an unlocked state.
 
 ~ReaderWriterMutexImpl ()
 Destroy this object.
 
void lockRead ()
 
void lockWrite ()
 
int tryLockRead ()
 
int tryLockWrite ()
 
void unlock ()
 
void unlockRead ()
 
void unlockWrite ()
 
bool isLocked () const
 
bool isLockedRead () const
 
bool isLockedWrite () const
 

Detailed Description

template<class ATOMIC_OP, class MUTEX, class SEMAPHORE>
class bslmt::ReaderWriterMutexImpl< ATOMIC_OP, MUTEX, SEMAPHORE >

This class provides a multi-reader/single-writer lock mechanism.

See bslmt_readerwritermuteximpl

Constructor & Destructor Documentation

◆ ReaderWriterMutexImpl()

template<class ATOMIC_OP , class MUTEX , class SEMAPHORE >
bslmt::ReaderWriterMutexImpl< ATOMIC_OP, MUTEX, SEMAPHORE >::ReaderWriterMutexImpl ( )
inline

◆ ~ReaderWriterMutexImpl()

template<class ATOMIC_OP , class MUTEX , class SEMAPHORE >
bslmt::ReaderWriterMutexImpl< ATOMIC_OP, MUTEX, SEMAPHORE >::~ReaderWriterMutexImpl ( )

Member Function Documentation

◆ isLocked()

template<class ATOMIC_OP , class MUTEX , class SEMAPHORE >
bool bslmt::ReaderWriterMutexImpl< ATOMIC_OP, MUTEX, SEMAPHORE >::isLocked ( ) const
inline

Return true if this reader-write mutex is currently read locked or write locked, and false otherwise.

◆ isLockedRead()

template<class ATOMIC_OP , class MUTEX , class SEMAPHORE >
bool bslmt::ReaderWriterMutexImpl< ATOMIC_OP, MUTEX, SEMAPHORE >::isLockedRead ( ) const
inline

Return true if this reader-write mutex is currently read locked, and false otherwise.

◆ isLockedWrite()

template<class ATOMIC_OP , class MUTEX , class SEMAPHORE >
bool bslmt::ReaderWriterMutexImpl< ATOMIC_OP, MUTEX, SEMAPHORE >::isLockedWrite ( ) const
inline

Return true if this reader-write mutex is currently write locked, and false otherwise.

◆ lockRead()

template<class ATOMIC_OP , class MUTEX , class SEMAPHORE >
void bslmt::ReaderWriterMutexImpl< ATOMIC_OP, MUTEX, SEMAPHORE >::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 unlockRead or 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()

template<class ATOMIC_OP , class MUTEX , class SEMAPHORE >
void bslmt::ReaderWriterMutexImpl< ATOMIC_OP, MUTEX, SEMAPHORE >::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 unlockWrite or 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()

template<class ATOMIC_OP , class MUTEX , class SEMAPHORE >
int bslmt::ReaderWriterMutexImpl< ATOMIC_OP, MUTEX, SEMAPHORE >::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, unlockRead or 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()

template<class ATOMIC_OP , class MUTEX , class SEMAPHORE >
int bslmt::ReaderWriterMutexImpl< ATOMIC_OP, MUTEX, SEMAPHORE >::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, unlockWrite or 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()

template<class ATOMIC_OP , class MUTEX , class SEMAPHORE >
void bslmt::ReaderWriterMutexImpl< ATOMIC_OP, MUTEX, SEMAPHORE >::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.

◆ unlockRead()

template<class ATOMIC_OP , class MUTEX , class SEMAPHORE >
void bslmt::ReaderWriterMutexImpl< ATOMIC_OP, MUTEX, SEMAPHORE >::unlockRead ( )
inline

Release the read lock that the calling thread holds on this reader-writer mutex. The behavior is undefined unless the calling thread currently has a read lock on this mutex.

◆ unlockWrite()

template<class ATOMIC_OP , class MUTEX , class SEMAPHORE >
void bslmt::ReaderWriterMutexImpl< ATOMIC_OP, MUTEX, SEMAPHORE >::unlockWrite ( )
inline

Release the write lock that the calling thread holds on this reader-writer mutex. The behavior is undefined unless the calling thread currently has a write lock on this mutex.


The documentation for this class was generated from the following file: