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

Create a guard associated with the specified `qlock`&period; Acquire the lock unless the (optionally) specified `doLock` is false&period; If the `lock` is not free, block until it can be acquired&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
QLockGuard(
    xref:BloombergLP/bslmt/QLock.adoc[QLock]* qlock,
    bool doLock = true);
----


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