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

Create a scoped guard that conditionally manages the specified `lock` (if non&hyphen;null) and invokes `lock&hyphen;&gt;unlock()` if the specified `alreadyUnlockedFlag` is `false`&period; Supplying a null `lock` has no effect&period; The behavior is undefined unless the state of `lock` (if non&hyphen;null) is consistent with `alreadyUnlockedFlag`&period; Note that `alreadyUnlockedFlag` is used to indicate whether `lock` is in an already&hyphen;unlocked state when passed, so if `alreadyUnlockedFlag` is `true` the `unlock` method will _not_ be called on the supplied `lock`&period; Also note that `lock` must remain valid throughout the lifetime of this guard, or until `release` is called&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
ReadLockGuardUnlock(
    T* lock,
    bool alreadyUnlockedFlag);
----


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