fsfw/src/fsfw/osal/host/Mutex.h

30 lines
717 B
C
Raw Normal View History

2020-09-05 21:19:53 +02:00
#ifndef FSFW_OSAL_HOSTED_MUTEX_H_
#define FSFW_OSAL_HOSTED_MUTEX_H_
2020-09-05 20:18:52 +02:00
#include <mutex>
2022-02-02 10:29:30 +01:00
#include "fsfw/ipc/MutexIF.h"
2020-09-05 20:18:52 +02:00
/**
* @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 {
2022-02-02 10:29:30 +01:00
public:
Mutex();
ReturnValue_t lockMutex(TimeoutType timeoutType = TimeoutType::BLOCKING,
uint32_t timeoutMs = 0) override;
ReturnValue_t unlockMutex() override;
std::timed_mutex* getMutexHandle();
2020-09-05 20:18:52 +02:00
2022-02-02 10:29:30 +01:00
private:
std::timed_mutex mutex;
2020-09-05 20:18:52 +02:00
};
2020-09-05 21:19:53 +02:00
#endif /* FSFW_OSAL_HOSTED_MUTEX_H_ */