[#BloombergLP-bslmt-RecursiveMutexImpl-01-tryLock] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/RecursiveMutexImpl-01.adoc[RecursiveMutexImpl<Platform::PosixThreads>]::tryLock :relfileprefix: ../../../ :mrdocs: Attempt to acquire a lock on this mutex object. == Synopsis Declared in `<bslmt_recursivemuteximpl_pthread.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int tryLock(); ---- == Description 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. == Return Value 0 on success, and a non‐zero value if already locked by another thread or on error [.small]#Created with https://www.mrdocs.com[MrDocs]#