[#BloombergLP-bslmt-TryLockGuard-2constructor]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/TryLockGuard.adoc[TryLockGuard]::TryLockGuard
:relfileprefix: ../../../
:mrdocs:

Create a guard that tries to acquire a lock on `lock`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
TryLockGuard(
    T* lock,
    int attempts = 1);
----

== Parameters

[cols="1,4"]
|===
| Name| Description
| *lock*
| lock object to try&hyphen;lock&semi; may be null
| *attempts*
| maximum number of try&hyphen;lock attempts
|===


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