From d8950c4eb41f650bc0f244b16ae93f441641b005 Mon Sep 17 00:00:00 2001 From: wellenvogel Date: Wed, 1 Dec 2021 21:01:19 +0100 Subject: [PATCH] add missing file --- lib/queue/GwSynchronized.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 lib/queue/GwSynchronized.h diff --git a/lib/queue/GwSynchronized.h b/lib/queue/GwSynchronized.h new file mode 100644 index 0000000..53241db --- /dev/null +++ b/lib/queue/GwSynchronized.h @@ -0,0 +1,17 @@ +#pragma once +#include + +class GwSynchronized{ + private: + SemaphoreHandle_t *locker; + public: + GwSynchronized(SemaphoreHandle_t *locker){ + this->locker=locker; + xSemaphoreTake(*locker, portMAX_DELAY); + } + ~GwSynchronized(){ + xSemaphoreGive(*locker); + } +}; + +#define GWSYNCHRONIZED(locker) GwSynchronized __xlock__(locker); \ No newline at end of file