Quick Links:

bal | bbl | bdl | bsl

Public Member Functions

bsls::BslLockGuard Class Reference

#include <bsls_bsllock.h>

List of all members.

Public Member Functions

 BslLockGuard (BslLock *lock)
 ~BslLockGuard ()
void release ()

Detailed Description

This class implements a guard for automatically acquiring and releasing the lock on an associated bsls::BslLock object. This mechanism follows the RAII idiom whereby the lock on the BslLock associated with a guard object is acquired upon construction and released upon destruction.

See Component bsls_bsllock


Constructor & Destructor Documentation

bsls::BslLockGuard::BslLockGuard ( BslLock lock  )  [explicit]

Create a guard object that conditionally manages the specified lock, and acquires the lock on lock by invoking its lock method. The behavior is undefined unless the calling thread does not already hold the lock on lock. Note that deadlock may result if a guard is created for lock while the calling thread holds the lock on lock. Also note that lock must remain valid throughout the lifetime of this guard, or until release is called.

bsls::BslLockGuard::~BslLockGuard (  ) 

Destroy this guard object and release the lock on the object it manages (if any) by invoking the unlock method of the object that was supplied at construction of this guard. If no lock is currently being managed, this method has no effect. Note that if this guard object currently manages a lock, this method assumes the behavior of BslLock::unlock.


Member Function Documentation

void bsls::BslLockGuard::release (  ) 

Release from management, with no effect, the object currently managed by this guard, if any. Note that unlock is not called on the managed object upon its release.


The documentation for this class was generated from the following file: