mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-03 19:29:57 +00:00
17a1262382
for dumb reasons)
34 lines
461 B
C++
34 lines
461 B
C++
#include "configuration.h"
|
|
#include "Lock.h"
|
|
#include <cassert>
|
|
|
|
namespace concurrency
|
|
{
|
|
|
|
#ifdef HAS_FREE_RTOS
|
|
Lock::Lock()
|
|
{
|
|
handle = xSemaphoreCreateBinary();
|
|
assert(handle);
|
|
assert(xSemaphoreGive(handle));
|
|
}
|
|
|
|
void Lock::lock()
|
|
{
|
|
assert(xSemaphoreTake(handle, portMAX_DELAY));
|
|
}
|
|
|
|
void Lock::unlock()
|
|
{
|
|
assert(xSemaphoreGive(handle));
|
|
}
|
|
#else
|
|
Lock::Lock() {}
|
|
|
|
void Lock::lock() {}
|
|
|
|
void Lock::unlock() {}
|
|
#endif
|
|
|
|
} // namespace concurrency
|