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

commit df17524e55176fda4c45b845b7ced7e064faf0db
Author: wangchengdong <[email protected]>
AuthorDate: Sun Nov 23 22:36:40 2025 +0800

    sched/signal: Use clock_compare() in nxsig_clockwait()
    
    clock_compare() should be used when comparing clock tick values to
    ensure correct handling of tick wrap-around and time ordering.
    
    Signed-off-by: Chengdong Wang [email protected]
---
 sched/signal/sig_timedwait.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sched/signal/sig_timedwait.c b/sched/signal/sig_timedwait.c
index e419305d51f..234e472fb07 100644
--- a/sched/signal/sig_timedwait.c
+++ b/sched/signal/sig_timedwait.c
@@ -256,7 +256,7 @@ int nxsig_clockwait(int clockid, int flags,
         }
 
         wd_start_abstick(&rtcb->waitdog, expect,
-                          nxsig_timeout, (uintptr_t)rtcb);
+                         nxsig_timeout, (uintptr_t)rtcb);
     }
 
   /* Remove the tcb task from the ready-to-run list. */
@@ -283,7 +283,8 @@ int nxsig_clockwait(int clockid, int flags,
 
   if (rqtp && rmtp && expect)
     {
-      clock_ticks2time(rmtp, expect > stop ? expect - stop : 0);
+      clock_ticks2time(rmtp,
+                       clock_compare(stop, expect) ? expect - stop : 0);
     }
 
   return 0;

Reply via email to