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

#include <mutex.hpp>

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

Public Member Functions

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

Standard 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 not recursively acquirable. Calling Lock() twice from the same Thread (i.e. task) will deadlock.

Note
Standard mutexes use less resources than recursive mutexes. You should typically use this type of Mutex, unless you have a strong need for a MutexRecursive mutex.

Definition at line 169 of file mutex.hpp.

Constructor & Destructor Documentation

◆ MutexStandard()

MutexStandard::MutexStandard ( )

Create a standard, non-recursize Mutex.

Exceptions
ThreadMutexExceptionon failure.

Definition at line 57 of file cmutex.cpp.

Member Function Documentation

◆ Lock()

bool MutexStandard::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 71 of file cmutex.cpp.

◆ Unlock()

bool MutexStandard::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 78 of file cmutex.cpp.


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