mn::basic_autolock< LOCK > Class Template Reference

#include <mn_lock.hpp>

+ Inheritance diagram for mn::basic_autolock< LOCK >:
+ Collaboration diagram for mn::basic_autolock< LOCK >:

Public Member Functions

 basic_autolock (LOCK &m)
 
 basic_autolock (LOCK &m, unsigned long xTicksToWait)
 
 ~basic_autolock ()
 
 operator bool ()
 

Private Attributes

LOCK & m_ref_lock
 

Detailed Description

template<class LOCK>
class mn::basic_autolock< LOCK >

Synchronization helper class that leverages the C++ language to help prevent deadlocks. This is a C++11 feature that allows ILockObject Locking and Unlocking to behave following an RAII style. The constructor of this helper object locks the ILockObject. The destructor unlocks the ILockObject.

Constructor & Destructor Documentation

◆ basic_autolock() [1/2]

template<class LOCK >
mn::basic_autolock< LOCK >::basic_autolock ( LOCK &  m)
inline

Create a basic_autolock with a specific LockType, without timeout

Postcondition
The LockObject will be locked.

◆ basic_autolock() [2/2]

template<class LOCK >
mn::basic_autolock< LOCK >::basic_autolock ( LOCK &  m,
unsigned long  xTicksToWait 
)
inline

Create a basic_autolock with a specific LockType, with timeout

Parameters
xTicksToWaitHow long to wait to get the lock until giving up.
Postcondition
The LockObject will be locked.

◆ ~basic_autolock()

template<class LOCK >
mn::basic_autolock< LOCK >::~basic_autolock ( )
inline

Destroy a basic_autolock.

Postcondition
The LockObject will be unlocked, when the lock Object locked

Member Function Documentation

◆ operator bool()

template<class LOCK >
mn::basic_autolock< LOCK >::operator bool ( )
inline

Member Data Documentation

◆ m_ref_lock

template<class LOCK >
LOCK& mn::basic_autolock< LOCK >::m_ref_lock
private

Reference to the LockObject we locked, so it can be unlocked in the destructor.


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