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

Portable wrapper of an OS&hyphen;level mutex for intra&hyphen;process synchronization&period;

== Synopsis

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

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

== Description

This `class` implements a lightweight, portable wrapper of an OS&hyphen;level mutex lock to support intra&hyphen;process synchronization&period; The behavior is undefined if the `lock` method of this class is invoked more than once on the same mutex object in the same thread without an intervening call to `unLock`&period;

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslmt/Mutex/NativeType.adoc[`NativeType`] 
| `NativeType` is an alias for the underlying OS&hyphen;level mutex type&period; It is exposed so that other `bslmt` components can operate directly on this mutex&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslmt/Mutex/2constructor.adoc[`Mutex`]         [.small]#[constructor]#
| Create a mutex object in the unlocked state&period; This method does not return normally unless there are sufficient system resources to construct the object&period;
| xref:BloombergLP/bslmt/Mutex/2destructor.adoc[`&#126;Mutex`] [.small]#[destructor]#
| Destroy this mutex object&period; The behavior is undefined if the mutex is in a locked state&period;
| xref:BloombergLP/bslmt/Mutex/lock.adoc[`lock`] 
| Acquire a lock on this mutex, blocking if necessary&period;
| xref:BloombergLP/bslmt/Mutex/nativeMutex.adoc[`nativeMutex`] 
| Return a reference to the underlying OS&hyphen;level mutex&period;
| xref:BloombergLP/bslmt/Mutex/tryLock.adoc[`tryLock`] 
| Attempt to acquire a lock on this mutex without blocking&period;
| xref:BloombergLP/bslmt/Mutex/unlock.adoc[`unlock`] 
| Release a previously acquired lock on this mutex&period;
|===



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