SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Member Functions | List of all members
smtk::resource::ScopedLockGuard Class Reference

A scope-guarded utility for handling locks. More...

#include <Lock.h>

Public Member Functions

 ScopedLockGuard (Lock &, LockType)
 A constructor that blocks until it is able to acquire a lock of the given lockType.
 
 ScopedLockGuard (Lock &alreadyAcquiredLock, LockType lockType, bool alreadyAcquired)
 Construct a guard without acquiring the lock (because it is already held by the caller). More...
 
 ~ScopedLockGuard ()
 Release the lock held at construction time in this destructor.
 
bool operator< (const ScopedLockGuard &other) const
 A comparator so guards can be held in ordered containers.
 

Detailed Description

A scope-guarded utility for handling locks.

As long as an instance of this class is alive, the lock passed to its constructor is held. Upon destruction of this instance, the lock is released.

Constructor & Destructor Documentation

◆ ScopedLockGuard()

smtk::resource::ScopedLockGuard::ScopedLockGuard ( Lock alreadyAcquiredLock,
LockType  lockType,
bool  alreadyAcquired 
)

Construct a guard without acquiring the lock (because it is already held by the caller).

A constructor for ScopedLockSetGuard to use when tryLock() has already incremented lock counters for us. The last argument is ignored; it is used to differentiate between the public constructor and this one.


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