Skip to content

Commit 44649a2

Browse files
committed
Fix potential race condition in z_task_cancel
1 parent 207c636 commit 44649a2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/system/freertos_plus_tcp/system.c

+4
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,14 @@ z_result_t _z_task_detach(_z_task_t *task) {
128128

129129
z_result_t _z_task_cancel(_z_task_t *task) {
130130
xEventGroupSetBits(task->join_event, 1);
131+
132+
taskENTER_CRITICAL();
131133
if (task->handle != NULL) {
132134
vTaskDelete(task->handle);
133135
task->handle = NULL;
134136
}
137+
taskEXIT_CRITICAL();
138+
135139
return _Z_RES_OK;
136140
}
137141

0 commit comments

Comments
 (0)