mn::basic_autounlock< LOCK > Class Template Reference

#include <mn_lock.hpp>

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

Public Member Functions

 basic_autounlock (LOCK &m)
 
 basic_autounlock (LOCK &m, unsigned long xTicksToWait)
 
 ~basic_autounlock ()
 
void set_timeout (unsigned long xTicksToWait=portMAX_DELAY)
 
 operator bool ()
 

Private Attributes

LOCK & m_ref_lock
 
unsigned long m_xTicksToWait
 A saved / coped lock timeout for lock in the destructor. More...
 

Detailed Description

template<class LOCK>
class mn::basic_autounlock< LOCK >

This is a C++11 feature that allows ILockObject Locking and unlocking to behave following an RAII style. The constructor of this helper object unlocks the ILockObject. The destructor locks the ILockObject.

Constructor & Destructor Documentation

◆ basic_autounlock() [1/2]

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

Create a basic_autounlock with a specific LockType.

Postcondition
The LockObject will be unlocked.

◆ basic_autounlock() [2/2]

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

◆ ~basic_autounlock()

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

Destroy a basic_autounlock.

Postcondition
The LockObject will be locked.

Member Function Documentation

◆ operator bool()

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

◆ set_timeout()

template<class LOCK >
void mn::basic_autounlock< LOCK >::set_timeout ( unsigned long  xTicksToWait = portMAX_DELAY)
inline

Member Data Documentation

◆ m_ref_lock

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

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

◆ m_xTicksToWait

template<class LOCK >
unsigned long mn::basic_autounlock< LOCK >::m_xTicksToWait
private

A saved / coped lock timeout for lock in the destructor.


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