FreeRTOS C++ Wrappers  1.6.0
C++ interface to FreeRTOS
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cpp_freertos::Mutex Class Referenceabstract

#include <mutex.hpp>

Inheritance diagram for cpp_freertos::Mutex:
Inheritance graph
[legend]

Public Member Functions

virtual bool Lock (TickType_t Timeout=portMAX_DELAY)=0
 
virtual bool Unlock ()=0
 
virtual ~Mutex ()
 

Protected Member Functions

 Mutex ()
 

Protected Attributes

SemaphoreHandle_t handle
 

Detailed Description

Base wrapper class around FreeRTOS's implementation of mutexes.

By definition, Mutexes can NOT be used from ISR contexts.

Note
It is expected that an application will instantiate one of the derived classes and use that object for synchronization. It is not expected that a user or application will derive from these classes.

Definition at line 107 of file mutex.hpp.

Constructor & Destructor Documentation

◆ ~Mutex()

Mutex::~Mutex ( )
virtual

Our destructor

Definition at line 51 of file cmutex.cpp.

◆ Mutex()

Mutex::Mutex ( )
protected

This constructor should not be public.

Definition at line 46 of file cmutex.cpp.

Member Function Documentation

◆ Lock()

virtual bool cpp_freertos::Mutex::Lock ( TickType_t  Timeout = portMAX_DELAY)
pure virtual

Lock the Mutex.

Each type of Mutex implements it's own locking code as per the FreeRTOS API.

Parameters
TimeoutHow long to wait to get the Lock until giving up.
Returns
true if the Lock was acquired, false if it timed out.

Implemented in cpp_freertos::MutexRecursive, and cpp_freertos::MutexStandard.

◆ Unlock()

virtual bool cpp_freertos::Mutex::Unlock ( )
pure virtual

Unlock the Mutex.

Returns
true if the Lock was released, false if it failed. (Hint, if it fails, did you call Lock() first?)

Implemented in cpp_freertos::MutexRecursive, and cpp_freertos::MutexStandard.

Member Data Documentation

◆ handle

SemaphoreHandle_t cpp_freertos::Mutex::handle
protected

FreeRTOS semaphore handle.

Definition at line 149 of file mutex.hpp.


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