Skip to content

Commit

Permalink
Fix potential race condition in z_task_cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
bjsowa committed Dec 10, 2024
1 parent 17d689f commit c0c562e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/system/freertos_plus_tcp/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,14 @@ z_result_t _z_task_detach(_z_task_t *task) {

z_result_t _z_task_cancel(_z_task_t *task) {
xEventGroupSetBits(task->join_event, 1);

taskENTER_CRITICAL();
if (task->handle != NULL) {
vTaskDelete(task->handle);
task->handle = NULL;
}
taskEXIT_CRITICAL();

return _Z_RES_OK;
}

Expand Down

0 comments on commit c0c562e

Please sign in to comment.