FreeRTOS Addons
Loading...
Searching...
No Matches
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:
cpp_freertos::MutexRecursive cpp_freertos::MutexStandard

Public Member Functions

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

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.

Constructor & Destructor Documentation

◆ ~Mutex()

Mutex::~Mutex ( )
virtual

Our destructor

◆ Mutex()

Mutex::Mutex ( )
protected

This constructor should not be public.

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::MutexStandard, and cpp_freertos::MutexRecursive.

◆ 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::MutexStandard, and cpp_freertos::MutexRecursive.

Member Data Documentation

◆ handle

SemaphoreHandle_t cpp_freertos::Mutex::handle
protected

FreeRTOS semaphore handle.


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