Files
firmware/src/concurrency/Lock.h

34 lines
514 B
C
Raw Normal View History

#pragma once
#include "freertosinc.h"
namespace concurrency {
2020-07-06 00:54:30 +02:00
/**
* @brief Simple wrapper around FreeRTOS API for implementing a mutex lock
*/
class Lock
{
public:
Lock();
Lock(const Lock &) = delete;
Lock &operator=(const Lock &) = delete;
/// Locks the lock.
//
// Must not be called from an ISR.
void lock();
// Unlocks the lock.
//
// Must not be called from an ISR.
void unlock();
private:
SemaphoreHandle_t handle;
};
} // namespace concurrency