This is an automated email from the ASF dual-hosted git repository. archer pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit ace17ad9022b7d0041319484ab1d09c7c44ad3ee Author: wangchengdong <[email protected]> AuthorDate: Mon Oct 27 09:17:37 2025 +0800 sched/sched: Use nxsched_wakeup() to implement nxsched_timeout() Refactor nxsched_timeout() to use nxsched_wakeup() in order to eliminate code duplication and improve maintainability. Signed-off-by: Chengdong Wang [email protected] --- sched/sched/sched_sleep.c | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/sched/sched/sched_sleep.c b/sched/sched/sched_sleep.c index 754e5e987ed..9cfa03bcb09 100644 --- a/sched/sched/sched_sleep.c +++ b/sched/sched/sched_sleep.c @@ -52,42 +52,7 @@ static void nxsched_timeout(wdparm_t arg) { - FAR struct tcb_s *wtcb; - irqstate_t flags; - - /* Get waiting tcb from parameter */ - - wtcb = (FAR struct tcb_s *)(uintptr_t)arg; - - /* We must be in a critical section in order to call up_switch_context() - * below. - */ - - flags = enter_critical_section(); - - /* There may be a race condition -- make sure the task is - * still waiting for a signal - */ - - if (wtcb->task_state == TSTATE_WAIT_SIG) - { - FAR struct tcb_s *rtcb = this_task(); - - /* Remove the task from waiting list */ - - dq_rem((FAR dq_entry_t *)wtcb, list_waitingforsignal()); - - /* Add the task to ready-to-run task list, and - * perform the context switch if one is needed - */ - - if (nxsched_add_readytorun(wtcb)) - { - up_switch_context(this_task(), rtcb); - } - } - - leave_critical_section(flags); + nxsched_wakeup((FAR struct tcb_s *)(uintptr_t)arg); } /****************************************************************************
