diff --git a/src/AsyncWebSynchronization.h b/src/AsyncWebSynchronization.h index f36c52dcf..b852c4719 100644 --- a/src/AsyncWebSynchronization.h +++ b/src/AsyncWebSynchronization.h @@ -26,11 +26,11 @@ class AsyncWebLock } bool lock() const { - extern void *pxCurrentTCB; - if (_lockedBy != pxCurrentTCB) { - xSemaphoreTake(_lock, portMAX_DELAY); - _lockedBy = pxCurrentTCB; - return true; + TaskHandle_t currentTask = xTaskGetCurrentTaskHandle(); + if (_lockedBy != currentTask) { + xSemaphoreTake(_lock, portMAX_DELAY); + _lockedBy = currentTask; + return true; } return false; } @@ -84,4 +84,4 @@ class AsyncWebLockGuard } }; -#endif // ASYNCWEBSYNCHRONIZATION_H_ \ No newline at end of file +#endif // ASYNCWEBSYNCHRONIZATION_H_