[#BloombergLP-bslmt-RecursiveMutexImpl-01]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/RecursiveMutexImpl-0a.adoc[RecursiveMutexImpl]&lt;xref:BloombergLP/bslmt/Platform/PosixThreads.adoc[Platform::PosixThreads]&gt;
:relfileprefix: ../../
:mrdocs:

This class provides a full specialization of `RecursiveMutexImpl` for pthreads&period; If the pthreads implementation supports the &quot;recursive&quot; attribute, then the native implementation is used, otherwise, a portable, efficient implementation is provided&period;

== Synopsis

Declared in `&lt;bslmt&lowbar;recursivemuteximpl&lowbar;pthread&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;&gt;
class xref:BloombergLP/bslmt/RecursiveMutexImpl-0a.adoc[RecursiveMutexImpl]&lt;xref:BloombergLP/bslmt/Platform/PosixThreads.adoc[Platform::PosixThreads]&gt;;
----

== 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&period; This method does not return normally unless there are sufficient system resources to construct the object&period;
| xref:BloombergLP/bslmt/RecursiveMutexImpl-01/2destructor.adoc[`&#126;RecursiveMutexImpl`] [.small]#[destructor]#
| Destroy this recursive mutex object&period;
| xref:BloombergLP/bslmt/RecursiveMutexImpl-01/lock.adoc[`lock`] 
| Acquire a lock on this mutex object&period; If this object is currently locked by a different thread, then suspend execution of the current thread until a lock can be acquired&period; Otherwise, if it unlocked, or locked by the calling thread, then grant ownership of the lock immediately and return&period; 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&period;
| xref:BloombergLP/bslmt/RecursiveMutexImpl-01/tryLock.adoc[`tryLock`] 
| Attempt to acquire a lock on this mutex object&period; If this object is unlocked, or locked by the calling thread, then grant ownership of the lock immediately and return 0&period; Otherwise If this object is currently locked by a different thread or if an error occurs, then return a non&hyphen;zero value&period; 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&period;
| 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`&period; The behavior is undefined, unless the calling thread currently owns the lock on this mutex&period; 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&period;
|===



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