FreeRTOS Addons
Loading...
Searching...
No Matches
Public Member Functions | List of all members
cpp_freertos::MutexRecursive Class Reference

#include <mutex.hpp>

Inheritance diagram for cpp_freertos::MutexRecursive:
cpp_freertos::Mutex

Public Member Functions

 MutexRecursive ()
 
virtual bool Lock (TickType_t Timeout=portMAX_DELAY)
 
virtual bool Unlock ()
 
- Public Member Functions inherited from cpp_freertos::Mutex
virtual ~Mutex ()
 
virtual bool Lock (TickType_t Timeout=portMAX_DELAY)=0
 
virtual bool Unlock ()=0
 

Additional Inherited Members

- Protected Member Functions inherited from cpp_freertos::Mutex
 Mutex ()
 
- Protected Attributes inherited from cpp_freertos::Mutex
SemaphoreHandle_t handle
 

Detailed Description

Recursive usage Mutex.

By default calls to Lock these objects block forever, but this can be changed by simply passing in a argument to the Lock() method. These objects are recursively acquirable. Calling Lock() twice from the same Thread (i.e. task) works fine. The caller just needs to be sure to call Unlock() as many times as Lock().

Note
Recursive mutexes use more resources than standard mutexes. You should be sure that you actually need this type of synchronization before using it.

Constructor & Destructor Documentation

◆ MutexRecursive()

MutexRecursive::MutexRecursive ( )

Create a recursize Mutex.

Exceptions
ThreadMutexExceptionon failure.

Member Function Documentation

◆ Lock()

bool MutexRecursive::Lock ( TickType_t  Timeout = portMAX_DELAY)
virtual

Lock the Mutex.

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

Implements cpp_freertos::Mutex.

◆ Unlock()

bool MutexRecursive::Unlock ( )
virtual

Unlock the Mutex.

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

Implements cpp_freertos::Mutex.


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