[#BloombergLP-bslmt-MutexImpl-06] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/MutexImpl-09.adoc[MutexImpl]<xref:BloombergLP/bslmt/Platform/PosixThreads.adoc[Platform::PosixThreads]> :relfileprefix: ../../ :mrdocs: This class provides a full specialization of `MutexImpl` for pthreads. It provides a efficient proxy for the `pthread_mutex_t` pthreads type, and related operations. Note that the mutex implemented in this class is _not_ error checking, and is non‐recursive. == Synopsis Declared in `<bslmt_muteximpl_pthread.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<> class xref:BloombergLP/bslmt/MutexImpl-09.adoc[MutexImpl]<xref:BloombergLP/bslmt/Platform/PosixThreads.adoc[Platform::PosixThreads]>; ---- == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/MutexImpl-06/NativeType.adoc[`NativeType`] | The underlying OS‐level type. Exposed so that other `bslmt` components can operate directly on this mutex. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/MutexImpl-06/2constructor.adoc[`MutexImpl`] [.small]#[constructor]# | Create a mutex initialized to an unlocked state. This method does not return normally unless there are sufficient system resources to construct the object. | xref:BloombergLP/bslmt/MutexImpl-06/2destructor.adoc[`~MutexImpl`] [.small]#[destructor]# | Destroy this mutex object. The behavior is undefined if the mutex is in a locked state. | xref:BloombergLP/bslmt/MutexImpl-06/lock.adoc[`lock`] | Acquire a lock on this mutex object. If this object is currently locked, then suspend execution of the current thread until a lock can be acquired. Note that the behavior is undefined if the calling thread already owns the lock on this mutex, and will likely result in a deadlock. | xref:BloombergLP/bslmt/MutexImpl-06/nativeMutex.adoc[`nativeMutex`] | Return a reference to the modifiable OS‐level mutex underlying this object. This method is intended only to support other `bslmt` components that must operate directly on this mutex. | xref:BloombergLP/bslmt/MutexImpl-06/tryLock.adoc[`tryLock`] | Attempt to acquire a lock on this mutex object. Return 0 on success, and a non‐zero value of this object is already locked, or if an error occurs. | xref:BloombergLP/bslmt/MutexImpl-06/unlock.adoc[`unlock`] | Release a lock on this mutex that was previously acquired through a successful call to `lock`, or `tryLock`. The behavior is undefined, unless the calling thread currently owns the lock on this mutex. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#