| 47 | } |
| 48 | |
| 49 | void MutexESP32::lock() { |
| 50 | FL_ASSERT(mHandle != nullptr, "MutexESP32::lock() called on null mutex"); |
| 51 | |
| 52 | SemaphoreHandle_t handle = static_cast<SemaphoreHandle_t>(mHandle); |
| 53 | |
| 54 | // Block indefinitely waiting for the mutex |
| 55 | BaseType_t result = xSemaphoreTake(handle, portMAX_DELAY); |
| 56 | |
| 57 | FL_ASSERT(result == pdTRUE, "MutexESP32::lock() failed to acquire mutex"); |
| 58 | } |
| 59 | |
| 60 | void MutexESP32::unlock() { |
| 61 | FL_ASSERT(mHandle != nullptr, "MutexESP32::unlock() called on null mutex"); |