Boboter
Loading...
Searching...
No Matches
smart_mutex.h
Go to the documentation of this file.
1
7
8
#pragma once
9
10
#include <freertos/FreeRTOS.h>
11
22
class
smart_mutex
{
23
private
:
24
SemaphoreHandle_t mutex;
25
26
public
:
27
explicit
smart_mutex
(SemaphoreHandle_t mutex) : mutex(mutex) {
28
xSemaphoreTake(mutex, portMAX_DELAY);
29
}
30
31
~smart_mutex
() {
32
xSemaphoreGive(mutex);
33
}
34
35
smart_mutex
(
const
smart_mutex
&) =
delete
;
36
smart_mutex
&
operator=
(
const
smart_mutex
&) =
delete
;
37
};
smart_mutex::smart_mutex
smart_mutex(SemaphoreHandle_t mutex)
Definition
smart_mutex.h:27
smart_mutex::operator=
smart_mutex & operator=(const smart_mutex &)=delete
smart_mutex::~smart_mutex
~smart_mutex()
Definition
smart_mutex.h:31
smart_mutex::smart_mutex
smart_mutex(const smart_mutex &)=delete
types
smart_mutex.h
Generated by
1.15.0