[#BloombergLP-bslmt-Mutex] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::Mutex :relfileprefix: ../../ :mrdocs: Portable wrapper of an OS‐level mutex for intra‐process synchronization. == Synopsis Declared in `<bslmt_mutex.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class Mutex; ---- == Description This `class` implements a lightweight, portable wrapper of an OS‐level mutex lock to support intra‐process synchronization. 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`. == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/Mutex/NativeType.adoc[`NativeType`] | `NativeType` is an alias for the underlying OS‐level mutex type. It is exposed so that other `bslmt` components can operate directly on this mutex. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/Mutex/2constructor.adoc[`Mutex`] [.small]#[constructor]# | Create a mutex object in the unlocked state. This method does not return normally unless there are sufficient system resources to construct the object. | xref:BloombergLP/bslmt/Mutex/2destructor.adoc[`~Mutex`] [.small]#[destructor]# | Destroy this mutex object. The behavior is undefined if the mutex is in a locked state. | xref:BloombergLP/bslmt/Mutex/lock.adoc[`lock`] | Acquire a lock on this mutex, blocking if necessary. | xref:BloombergLP/bslmt/Mutex/nativeMutex.adoc[`nativeMutex`] | Return a reference to the underlying OS‐level mutex. | xref:BloombergLP/bslmt/Mutex/tryLock.adoc[`tryLock`] | Attempt to acquire a lock on this mutex without blocking. | xref:BloombergLP/bslmt/Mutex/unlock.adoc[`unlock`] | Release a previously acquired lock on this mutex. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#