diff --git a/sched/task_delete.c b/sched/task_delete.c index 4f463bd603..86a796ab75 100644 --- a/sched/task_delete.c +++ b/sched/task_delete.c @@ -118,10 +118,12 @@ STATUS task_delete(pid_t pid) /* Make sure the task does not become ready-to-run while * we are futzing with its TCB by locking ourselves as the * executing task. - * - * Frist, find for the TCB associated with matching pid */ + sched_lock(); + + /* Find for the TCB associated with matching pid */ + dtcb = sched_gettcb(pid); if (!dtcb) {