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

Constructors

== Synopses

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

Create a scoped guard that conditionally manages the specified `lock` (if non&hyphen;null) and invokes `lock&hyphen;&gt;unlock()`&period; Supplying a null `lock` has no effect&period; The behavior is undefined unless `lock` (if non&hyphen;null) is locked by this thread&period; Note that `lock` must remain valid throughout the lifetime of this guard, or until `release` is called&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
xref:BloombergLP/bslmt/WriteLockGuardUnlock/2constructor-04.adoc[WriteLockGuardUnlock](T* lock);
----

[.small]#xref:BloombergLP/bslmt/WriteLockGuardUnlock/2constructor-04.adoc[_» more&period;&period;&period;_]#

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;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslmt/WriteLockGuardUnlock/2constructor-00.adoc[WriteLockGuardUnlock](
    T* lock,
    bool alreadyUnlockedFlag);
----

[.small]#xref:BloombergLP/bslmt/WriteLockGuardUnlock/2constructor-00.adoc[_» more&period;&period;&period;_]#


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