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

Constructors

== Synopses

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

Create a scoped guard that acquires a write lock on `lock`&period;


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

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

Create a scoped guard that conditionally acquires a write lock on `lock`&period;


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

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

== Parameters

[cols="1,4"]
|===
| Name| Description
| *lock*
| lock object to acquire for writing&semi; may be null
| *alreadyLockedFlag*
| `true` if `lock` is already write&hyphen;locked
|===


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