Remove unused variable; add assertion for failed semaphore creation

This commit is contained in:
Ulrich Lukas
2020-11-16 21:35:43 +01:00
parent 344062ae5b
commit dc6e2a31da

View File

@@ -15,11 +15,13 @@ class AsyncPlainLock
{ {
private: private:
SemaphoreHandle_t _lock; SemaphoreHandle_t _lock;
mutable void *_lockedBy;
public: public:
AsyncPlainLock() { AsyncPlainLock() {
_lock = xSemaphoreCreateBinary(); _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); xSemaphoreGive(_lock);
} }
@@ -47,6 +49,9 @@ private:
public: public:
AsyncWebLock() { AsyncWebLock() {
_lock = xSemaphoreCreateBinary(); _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; _lockedBy = NULL;
xSemaphoreGive(_lock); xSemaphoreGive(_lock);
} }