2#include "TinyRobotics/utils/Config.h"
3#include "TinyRobotics/concurrency/Mutex.h"
6# include "freertos/FreeRTOS.h"
7# include "freertos/semphr.h"
8#elif defined(__linux__
)
14namespace tinyrobotics {
17
18
19
20
21
25 xSemaphore = xSemaphoreCreateBinary();
28 virtual ~MutexRTOS() {
29 vSemaphoreDelete(xSemaphore);
31 void lock()
override {
32 xSemaphoreTake(xSemaphore, portMAX_DELAY);
34 void unlock()
override {
35 xSemaphoreGive(xSemaphore);
39 SemaphoreHandle_t xSemaphore =
NULL;
43
44
45
46
47
51 MutexRecursiveRTOS() {
52 xSemaphore = xSemaphoreCreateBinary();
55 virtual ~MutexRecursiveRTOS() {
56 vSemaphoreDelete(xSemaphore);
58 void lock()
override {
59 xSemaphoreTakeRecursive(xSemaphore, portMAX_DELAY);
61 void unlock()
override {
62 xSemaphoreGiveRecursive(xSemaphore);
66 SemaphoreHandle_t xSemaphore =
NULL;
Empty Mutex implementation which does nothing.
Definition: Mutex.h:18
Mutex implemntation using FreeRTOS.
Definition: MutexRTOS.h:22
Recursive Mutex implemntation using FreeRTOS.
Definition: MutexRTOS.h:49