mn::system::basic_critical_section_timedout Class Reference

#include <mn_criticalsection.hpp>

+ Inheritance diagram for mn::system::basic_critical_section_timedout:
+ Collaboration diagram for mn::system::basic_critical_section_timedout:

Public Member Functions

 basic_critical_section_timedout ()
 
virtual int lock (unsigned int timeout=UINT_MAX)
 
virtual int time_lock (const struct timespec *timeout)
 
virtual int unlock ()
 
virtual bool try_lock ()
 
- Public Member Functions inherited from mn::system::ISystemLockObject
virtual bool is_initialized ()
 
- Public Member Functions inherited from mn::ILockObject
 ILockObject ()
 
virtual bool is_initialized () const =0
 
virtual bool is_locked () const =0
 Is locked? More...
 

Protected Attributes

portMUX_TYPE m_pHandle
 

Additional Inherited Members

- Public Types inherited from mn::ILockObject
using this_type = ILockObject
 

Detailed Description

Wrapper class around FreeRTOS's implementation of a critical sections. Acquire a portmux spinlock with a timeout

Note
Use the follow FreeRTOS functions:
vPortCPUAcquireMutexTimeout and vPortCPUReleaseMutex

Constructor & Destructor Documentation

◆ basic_critical_section_timedout()

mn::system::basic_critical_section_timedout::basic_critical_section_timedout ( )

Construtor initialize the cpu mutex use the FreeRTOS : vPortCPUInitializeMutex function

Member Function Documentation

◆ lock()

int mn::system::basic_critical_section_timedout::lock ( unsigned int  timeout = UINT_MAX)
virtual

enter the critical section

Parameters
timeoutHow long to wait (in ticks) to get the lock until giving up. By a given UINT_MAX then then use no timeout
Returns
ERR_SYSTEM_OK if enter in the critical section and ERR_SYSTEM_LOCK if it timed out.

Implements mn::ILockObject.

◆ time_lock()

int mn::system::basic_critical_section_timedout::time_lock ( const struct timespec *  timeout)
virtual

enter the critical section

Parameters
abs_timeHow long to wait (in timeval) to get the lock until giving up.
Returns
ERR_SYSTEM_OK if enter in the critical section and ERR_SYSTEM_LOCK if it timed out.

Reimplemented from mn::system::ISystemLockObject.

◆ try_lock()

bool mn::system::basic_critical_section_timedout::try_lock ( )
virtual

try to enter the critical section true if the Lock was acquired, false when not

Reimplemented from mn::ILockObject.

◆ unlock()

int mn::system::basic_critical_section_timedout::unlock ( )
virtual

leave the critical section

Returns
ERR_SYSTEM_NO_RETURN

Implements mn::ILockObject.

Member Data Documentation

◆ m_pHandle

portMUX_TYPE mn::system::basic_critical_section_timedout::m_pHandle
protected

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