BloombergLP::bslmt::QLockGuard

Guard that acquires and releases a lock on a QLock object.

Synopsis

Declared in <bslmt_qlock.h>

class QLockGuard;

Description

This class provides the means to acquire and release the lock on a QLock object. Typically, the lock is acquired at construction and released automatically on destruction. This class also provides explicit lock, tryLock, and unlock primitives.

Member Functions

NameDescription
QLockGuard [constructor]Constructors
~QLockGuard [destructor]Destroy this object. If this object holds a lock, automatically free it.
lock lock overloads
setQLock Associate this guard with the specified qlock. The behavior is undefined if this object is already in a locked state.
tryLock Attempt to acquire a lock on the associated QLock without blocking.
unlock Release the lock on the associated QLock. The behavior is undefined unless this guard previously acquired the lock and has not already released it.