[#BloombergLP-bslmt-RWMutex] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::RWMutex :relfileprefix: ../../ :mrdocs: Platform‐independent interface to a reader‐writer mutex. == Synopsis Declared in `<bslmt_rwmutex.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class RWMutex; ---- == Description 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. == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/RWMutex/2constructor.adoc[`RWMutex`] [.small]#[constructor]# | Create an RW mutex initialized to an unlocked state. | xref:BloombergLP/bslmt/RWMutex/2destructor.adoc[`~RWMutex`] [.small]#[destructor]# | Destroy this RW mutex. The behavior is undefined if the mutex is in a locked state. | xref:BloombergLP/bslmt/RWMutex/lockRead.adoc[`lockRead`] | Lock this reader‐writer mutex for reading. | xref:BloombergLP/bslmt/RWMutex/lockWrite.adoc[`lockWrite`] | Lock this reader‐writer mutex for writing. | xref:BloombergLP/bslmt/RWMutex/tryLockRead.adoc[`tryLockRead`] | Attempt to lock this reader‐writer mutex for reading. | xref:BloombergLP/bslmt/RWMutex/tryLockWrite.adoc[`tryLockWrite`] | Attempt to lock this reader‐writer mutex for writing. | xref:BloombergLP/bslmt/RWMutex/unlock.adoc[`unlock`] | Release the lock held by the calling thread on this mutex. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#