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

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

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
WriteLockGuard(T* lock);
----


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