mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-04 03:39:56 +00:00
24 lines
338 B
C++
24 lines
338 B
C++
|
#include "Lock.h"
|
||
|
#include <cassert>
|
||
|
|
||
|
namespace concurrency {
|
||
|
|
||
|
Lock::Lock()
|
||
|
{
|
||
|
handle = xSemaphoreCreateBinary();
|
||
|
assert(handle);
|
||
|
assert(xSemaphoreGive(handle));
|
||
|
}
|
||
|
|
||
|
void Lock::lock()
|
||
|
{
|
||
|
assert(xSemaphoreTake(handle, portMAX_DELAY));
|
||
|
}
|
||
|
|
||
|
void Lock::unlock()
|
||
|
{
|
||
|
assert(xSemaphoreGive(handle));
|
||
|
}
|
||
|
|
||
|
} // namespace concurrency
|