[#BloombergLP-bsls-BslLockGuard-2constructor]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bsls.adoc[bsls]::xref:BloombergLP/bsls/BslLockGuard.adoc[BslLockGuard]::BslLockGuard
:relfileprefix: ../../../
:mrdocs:

Create a guard that manages and acquires the specified `lock`&period;

== Synopsis

Declared in `&lt;bsls&lowbar;bsllock&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
BslLockGuard(xref:BloombergLP/bsls/BslLock.adoc[BslLock]* lock);
----

== Description

Create a guard object that conditionally manages the specified `lock`, and acquires the lock on `lock` by invoking its `lock` method&period; The behavior is undefined unless the calling thread does not already hold the lock on `lock`&period; Note that deadlock may result if a guard is created for `lock` while the calling thread holds the lock on `lock`&period; Also note that `lock` must remain valid throughout the lifetime of this guard, or until `release` is called&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *lock*
| mutex to manage and lock
|===


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