[#BloombergLP-bslmt-RecursiveMutexImpl-01] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/RecursiveMutexImpl-0a.adoc[RecursiveMutexImpl]<xref:BloombergLP/bslmt/Platform/PosixThreads.adoc[Platform::PosixThreads]> :relfileprefix: ../../ :mrdocs: This class provides a full specialization of `RecursiveMutexImpl` for pthreads. If the pthreads implementation supports the "recursive" attribute, then the native implementation is used, otherwise, a portable, efficient implementation is provided. == Synopsis Declared in `<bslmt_recursivemuteximpl_pthread.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<> class xref:BloombergLP/bslmt/RecursiveMutexImpl-0a.adoc[RecursiveMutexImpl]<xref:BloombergLP/bslmt/Platform/PosixThreads.adoc[Platform::PosixThreads]>; ---- == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/RecursiveMutexImpl-01/2constructor.adoc[`RecursiveMutexImpl`] [.small]#[constructor]# | Create a recursive 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/RecursiveMutexImpl-01/2destructor.adoc[`~RecursiveMutexImpl`] [.small]#[destructor]# | Destroy this recursive mutex object. | xref:BloombergLP/bslmt/RecursiveMutexImpl-01/lock.adoc[`lock`] | Acquire a lock on this mutex object. If this object is currently locked by a different thread, then suspend execution of the current thread until a lock can be acquired. Otherwise, if it unlocked, or locked by the calling thread, then grant ownership of the lock immediately and return. Note that when this object is recursively locked by a thread, `unlock` must be called an equal number of times before the lock is actually released. | xref:BloombergLP/bslmt/RecursiveMutexImpl-01/tryLock.adoc[`tryLock`] | Attempt to acquire a lock on this mutex object. If this object is unlocked, or locked by the calling thread, then grant ownership of the lock immediately and return 0. Otherwise If this object is currently locked by a different thread or if an error occurs, then return a non‐zero value. Note that when this object is recursively locked by a thread, `unlock` must be called an equal number of times before the lock is actually released. | xref:BloombergLP/bslmt/RecursiveMutexImpl-01/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. Note that when this object is recursively locked by a thread, `unlock` must be called an equal number of times before the lock is actually released. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#