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:
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);
}