BloombergLP::bslmt::QLockGuard

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.

Synopsis

Declared in <bslmt_qlock.h>

class QLockGuard;

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 object. Return 0 on success, a positive value of the associated QLock object is already locked, or a negative value if an error occurs.
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.