[#BloombergLP-bslmt-QLockGuard-tryLock]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/QLockGuard.adoc[QLockGuard]::tryLock
:relfileprefix: ../../../
:mrdocs:

Attempt to acquire a lock on the associated `QLock` object&period; Return 0 on success, a positive value of the associated QLock object is already locked, or a negative value if an error occurs&period;

== Synopsis

Declared in `&lt;bslmt&lowbar;qlock&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
tryLock();
----


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