sched/signal: Fix remaining time calculation in nxsig_clockwait()

Always compute the expected wake-up time by default, so the remaining
time can be calculated correctly when the flag is not TIMER_ABSTIME.

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
This commit is contained in:
wangchengdong
2025-11-23 21:46:34 +08:00
committed by Xiang Xiao
parent 02db473e97
commit a232815648
+12 -6
View File
@@ -238,19 +238,25 @@ int nxsig_clockwait(int clockid, int flags,
if ((flags & TIMER_ABSTIME) == 0) if ((flags & TIMER_ABSTIME) == 0)
{ {
expect = clock_delay2abstick(clock_time2ticks(rqtp)); expect = clock_delay2abstick(clock_time2ticks(rqtp));
wd_start_abstick(&rtcb->waitdog, expect,
nxsig_timeout, (uintptr_t)rtcb);
} }
else if (clockid == CLOCK_REALTIME) else if (clockid == CLOCK_REALTIME)
{ {
wd_start_realtime(&rtcb->waitdog, rqtp, #ifdef CONFIG_CLOCK_TIMEKEEPING
nxsig_timeout, (uintptr_t)rtcb); clock_t delay;
clock_abstime2ticks(CLOCK_REALTIME, rqtp, &delay);
expect = clock_delay2abstick(delay);
#else
clock_realtime2absticks(rqtp, &expect);
#endif
} }
else else
{ {
wd_start_abstime(&rtcb->waitdog, rqtp, expect = clock_time2ticks(rqtp);
nxsig_timeout, (uintptr_t)rtcb);
} }
wd_start_abstick(&rtcb->waitdog, expect,
nxsig_timeout, (uintptr_t)rtcb);
} }
/* Remove the tcb task from the ready-to-run list. */ /* Remove the tcb task from the ready-to-run list. */