mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-27 10:21:40 +00:00
36 lines
544 B
C++
36 lines
544 B
C++
#pragma once
|
|
|
|
#include "../freertosinc.h"
|
|
|
|
namespace concurrency
|
|
{
|
|
|
|
/**
|
|
* @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:
|
|
#ifdef HAS_FREE_RTOS
|
|
SemaphoreHandle_t handle;
|
|
#endif
|
|
};
|
|
|
|
} // namespace concurrency
|