mirror of
https://github.com/alexhopeoconnor/firmware.git
synced 2026-10-13 15:11:20 +10:00
* Refactor memory management in Syslog and StoreForwardModule * Implement destructor for Lock * Refactor RotaryEncoder and PacketHistory to use smart pointers for better memory management * CH341 should use unique_ptr for improved memory management * Fix checks in PH * Improve Syslog::vlogf to handle variable argument lists more safely * Fix initOk method to use nullptr for null pointer check
37 lines
557 B
C++
37 lines
557 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();
|
|
|
|
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
|