diff --git a/sched/sched/sched_addreadytorun.c b/sched/sched/sched_addreadytorun.c index b82a8d1b75..881dc7bcf9 100644 --- a/sched/sched/sched_addreadytorun.c +++ b/sched/sched/sched_addreadytorun.c @@ -165,6 +165,7 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb) { /* Yes.. that is the CPU we must use */ + task_state = TSTATE_TASK_ASSIGNED; cpu = btcb->cpu; } else @@ -173,6 +174,7 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb) * (possibly its IDLE task). */ + task_state = TSTATE_TASK_READYTORUN; cpu = nxsched_select_cpu(btcb->affinity); } @@ -191,24 +193,6 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb) task_state = TSTATE_TASK_RUNNING; } - /* If it will not be running, but is locked to a CPU, then it will be in - * the assigned state. - */ - - else if ((btcb->flags & TCB_FLAG_CPU_LOCKED) != 0) - { - task_state = TSTATE_TASK_ASSIGNED; - cpu = btcb->cpu; - } - - /* Otherwise, it will be ready-to-run, but not not yet running */ - - else - { - task_state = TSTATE_TASK_READYTORUN; - cpu = 0; /* CPU does not matter */ - } - /* If the selected state is TSTATE_TASK_RUNNING, then we would like to * start running the task. Be we cannot do that if pre-emption is * disabled. If the selected state is TSTATE_TASK_READYTORUN, then it