From dc6e2a31da631f02f28f758d7b505119bf19908c Mon Sep 17 00:00:00 2001 From: Ulrich Lukas Date: Mon, 16 Nov 2020 21:35:43 +0100 Subject: [PATCH] Remove unused variable; add assertion for failed semaphore creation --- src/AsyncWebSynchronization.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/AsyncWebSynchronization.h b/src/AsyncWebSynchronization.h index a044c50..02ad2dc 100644 --- a/src/AsyncWebSynchronization.h +++ b/src/AsyncWebSynchronization.h @@ -15,11 +15,13 @@ class AsyncPlainLock { private: SemaphoreHandle_t _lock; - mutable void *_lockedBy; public: AsyncPlainLock() { _lock = xSemaphoreCreateBinary(); + // In this fails, the system is likely that much out of memory that + // we should abort anyways. If assertions are disabled, nothing is lost.. + assert(_lock); xSemaphoreGive(_lock); } @@ -47,6 +49,9 @@ private: public: AsyncWebLock() { _lock = xSemaphoreCreateBinary(); + // In this fails, the system is likely that much out of memory that + // we should abort anyways. If assertions are disabled, nothing is lost.. + assert(_lock); _lockedBy = NULL; xSemaphoreGive(_lock); }