fsfw/osal/host/Mutex.h

30 lines
734 B
C
Raw Normal View History

2020-08-28 18:33:29 +02:00
#ifndef FRAMEWORK_OSAL_FREERTOS_MUTEX_H_
#define FRAMEWORK_OSAL_FREERTOS_MUTEX_H_
#include "../../ipc/MutexIF.h"
#include <mutex>
/**
* @brief OS component to implement MUTual EXclusion
*
* @details
* Mutexes are binary semaphores which include a priority inheritance mechanism.
* Documentation: https://www.freertos.org/Real-time-embedded-RTOS-mutexes.html
* @ingroup osal
*/
class Mutex : public MutexIF {
public:
2020-09-05 20:39:10 +02:00
Mutex();
ReturnValue_t lockMutex(TimeoutType timeoutType =
TimeoutType::BLOCKING, uint32_t timeoutMs = 0) override;
2020-08-28 18:33:29 +02:00
ReturnValue_t unlockMutex() override;
std::timed_mutex* getMutexHandle();
private:
bool locked = false;
std::timed_mutex mutex;
};
#endif /* FRAMEWORK_FREERTOS_MUTEX_H_ */