This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 2440b4ef394 sched/sched: Fix nxsched_suspend() logic
2440b4ef394 is described below
commit 2440b4ef3943809cb6c61b67d84a8bcbf11efbee
Author: wangchengdong <[email protected]>
AuthorDate: Thu Nov 13 10:15:55 2025 +0800
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 <[email protected]>
---
sched/sched/sched_suspend.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/sched/sched/sched_suspend.c b/sched/sched/sched_suspend.c
index 4bbb6c8a780..e9934940f33 100644
--- a/sched/sched/sched_suspend.c
+++ b/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
}