FreeRTOS C++ Wrappers  1.6.0
C++ interface to FreeRTOS
Public Member Functions | List of all members
cpp_freertos::MutexRecursive Class Reference

#include <mutex.hpp>

Inheritance diagram for cpp_freertos::MutexRecursive:
Inheritance graph
[legend]
Collaboration diagram for cpp_freertos::MutexRecursive:
Collaboration graph
[legend]

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 ()
 

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.

Definition at line 217 of file mutex.hpp.

Constructor & Destructor Documentation

◆ MutexRecursive()

MutexRecursive::MutexRecursive ( )

Create a recursize Mutex.

Exceptions
ThreadMutexExceptionon failure.

Definition at line 87 of file cmutex.cpp.

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.

Definition at line 101 of file cmutex.cpp.

◆ 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.

Definition at line 108 of file cmutex.cpp.


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