Create a scoped guard that acquires a write lock on lock.

Synopsis

Declared in <bslmt_writelockguard.h>

explicit
WriteLockGuard(T* lock);

Description

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

Parameters

Name

Description

lock

lock object to acquire for writing; may be null

Created with MrDocs