mirror of
https://github.com/apache/nuttx.git
synced 2026-08-09 22:45:08 +00:00
sched/sched: Fix nxsched_suspend() logic
nxsched_deliver_task() or nxsched_merge_pending() should only be called when a context switch is required. This behavior is independent of whether the current task is locked. Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
This commit is contained in:
parent
d996c2e758
commit
2440b4ef39
1 changed files with 3 additions and 4 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue