InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IDThreading::lock_guard< Mutex > Class Template Reference

#include <IDThreading.h>

Public Member Functions

 lock_guard (Mutex &mx)
 
 lock_guard (Mutex &mx, adopt_lock_t)
 
 ~lock_guard ()
 

Detailed Description

template<class Mutex>
class IDThreading::lock_guard< Mutex >

A lock_guard is an object that controls the ownership of an existing mutex object within a scope. It maintains ownership of the mutex object throughout the lock_guard object's lifetime. It does not manage the lifetime of the mutex it references. The behavior of a program is undefined if the mutex referenced by the lock_guard does not exist for the entire lifetime of the lock_guard object.

Constructor & Destructor Documentation

template<class Mutex >
IDThreading::lock_guard< Mutex >::lock_guard(Mutex & mx)
inlineexplicit

Acquires ownership of the specified mutex by calling mx.lock(). PRECONDITION: if Mutex is not a recursive mutex, the calling thread does not own the mutex mx.

template<class Mutex >
IDThreading::lock_guard< Mutex >::lock_guard(Mutex & mx,
adopt_lock_t  
)
inline

Adopts ownership of the mutex mx without calling lock(). PRECONDITION: the calling thread owns the mutex mx.

template<class Mutex >
IDThreading::lock_guard< Mutex >::~lock_guard()
inline

Releases the ownership of the mutex by calling mx.unlock(). PRECONDITION: The calling thread must own the mutex.