fix(esp_event): clear running_task before releasing mutex on tick timeout

When esp_event_loop_run() exited via the ticks-expired break path,
loop->running_task was left pointing to the current task handle.
Any subsequent trylock in esp_event_handler_unregister_with_internal()
would see a stale non-NULL running_task and take the wrong code path.
This commit is contained in:
Konstantin Kondrashov
2026-07-07 17:26:55 +03:00
parent d18301e7ff
commit bb8c0d5a2f

View File

@@ -764,6 +764,7 @@ esp_err_t esp_event_loop_run(esp_event_loop_handle_t event_loop, TickType_t tick
remaining_ticks -= end - marker;
// If the ticks to run expired, return to the caller
if (remaining_ticks <= 0) {
loop->running_task = NULL;
xSemaphoreGiveRecursive(loop->mutex);
break;
} else {