[#BloombergLP-bslmt-RWMutex]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::RWMutex
:relfileprefix: ../../
:mrdocs:

Platform&hyphen;independent interface to a reader&hyphen;writer mutex&period;

== Synopsis

Declared in `&lt;bslmt&lowbar;rwmutex&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class RWMutex;
----

== Description

This class is a platform&hyphen;independent interface to a reader&hyphen;writer lock (&quot;RW mutex&quot;)&period; Multiple readers can safely hold the lock simultaneously, whereas only one writer is allowed to hold the lock at a time&period; This class uses the most efficient RW mutex implementation available for the current platform&period; Note that the implementation may allow readers to starve writers&period;

== 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&period;
| xref:BloombergLP/bslmt/RWMutex/2destructor.adoc[`&#126;RWMutex`] [.small]#[destructor]#
| Destroy this RW mutex&period; The behavior is undefined if the mutex is in a locked state&period;
| xref:BloombergLP/bslmt/RWMutex/lockRead.adoc[`lockRead`] 
| Lock this reader&hyphen;writer mutex for reading&period;
| xref:BloombergLP/bslmt/RWMutex/lockWrite.adoc[`lockWrite`] 
| Lock this reader&hyphen;writer mutex for writing&period;
| xref:BloombergLP/bslmt/RWMutex/tryLockRead.adoc[`tryLockRead`] 
| Attempt to lock this reader&hyphen;writer mutex for reading&period;
| xref:BloombergLP/bslmt/RWMutex/tryLockWrite.adoc[`tryLockWrite`] 
| Attempt to lock this reader&hyphen;writer mutex for writing&period;
| xref:BloombergLP/bslmt/RWMutex/unlock.adoc[`unlock`] 
| Release the lock held by the calling thread on this mutex&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
