hujun260 commented on code in PR #17324:
URL: https://github.com/apache/nuttx/pull/17324#discussion_r2522518813
##########
sched/sched/sched_suspend.c:
##########
@@ -170,13 +170,12 @@ void nxsched_suspend(FAR struct tcb_s *tcb)
{
switch_needed = nxsched_remove_readytorun(tcb);
- if (switch_needed || !nxsched_islocked_tcb(rtcb))
+ if (switch_needed)
{
#ifdef CONFIG_SMP
- switch_needed |= nxsched_deliver_task(cpu, tcb->cpu,
- SWITCH_HIGHER);
+ nxsched_deliver_task(cpu, tcb->cpu, SWITCH_HIGHER);
#else
- switch_needed |= nxsched_merge_pending();
+ nxsched_merge_pending();
#endif
Review Comment:
#ifdef CONFIG_SMP
FAR struct tcb_s * ptcb = (FAR struct tcb_s
*)dq_peek(list_readytorun());
if (ptcb && ptcb->sched_priority > this_task()->sched_priority &&
nxsched_deliver_task(cpu, cpu, SWITCH_HIGHER))
#else
FAR struct tcb_s * ptcb = (FAR struct tcb_s
*)dq_peek(list_pendingtasks());
if (ptcb && nxsched_merge_pending())
#endif
{
switch_needed = true;
}
If we ignore the non-preemptive state, we should check all tasks that can be
run.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]