lean cpp library
A lean C++ library providing efficient utility classes for high-performance C++ applications.
Public Types | Public Member Functions
lean::smart::scoped_lock< Lockable, Policy > Class Template Reference

Automatic lock management class that locks a given object on construction to be unlocked on destruction. More...

#include <scoped_lock.h>

Inherits noncopyable.

List of all members.

Public Types

enum  adopt_lock_t { adopt_lock }
 Allows locked lockable objects to be adopted by a scoped lock object on construction. More...
typedef Lockable lock_type
 Type of the lock managed by this class.
typedef Policy policy_type
 Type of the locking policy used by this class.

Public Member Functions

LEAN_INLINE scoped_lock (lock_type &lock)
 Locks the given object, to be unlocked on destruction.
LEAN_INLINE scoped_lock (lock_type &lock, adopt_lock_t)
 Assumes that the given object is already locked, obtaining lock ownership and unlocking the lockable object on destruction.
LEAN_INLINE ~scoped_lock ()
 Unlocks the lock object managed by this class.
LEAN_INLINE lock_typeget (void)
 Gets the lock object managed by this class.
LEAN_INLINE const lock_typeget (void) const
 Gets the lock object managed by this class.

Detailed Description

template<class Lockable, class Policy = default_lock_policy<Lockable>>
class lean::smart::scoped_lock< Lockable, Policy >

Automatic lock management class that locks a given object on construction to be unlocked on destruction.


Member Enumeration Documentation

template<class Lockable , class Policy = default_lock_policy<Lockable>>
enum lean::smart::scoped_lock::adopt_lock_t

Allows locked lockable objects to be adopted by a scoped lock object on construction.

Enumerator:
adopt_lock 

Adopts a locked lockable object on scoped lock construction.


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