This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 99d1ec951b429437fe3ee8b4a7b072902b2910ec
Author: ganjing <[email protected]>
AuthorDate: Fri Jun 26 10:36:00 2026 +0800

    hrtimer: move UP_SEV() after hrtimer_unmark_running()
    
    UP_SEV() was firing before the hazard pointer was cleared, causing
    waiters to wake up only to find the condition unchanged and re-enter
    UP_WFE(). Move it after hrtimer_unmark_running() so waiters can
    actually exit the loop upon wakeup.
    
    Assisted-by: mimo-v2.6-pro
    Signed-off-by: ganjing <[email protected]>
---
 sched/hrtimer/hrtimer.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sched/hrtimer/hrtimer.h b/sched/hrtimer/hrtimer.h
index ebc14ccd65c..151169fb326 100644
--- a/sched/hrtimer/hrtimer.h
+++ b/sched/hrtimer/hrtimer.h
@@ -639,8 +639,10 @@ static inline_function void hrtimer_wait(FAR hrtimer_t 
*timer)
             {
               nxsched_usleep(HRTIMER_CANCEL_SYNC_DELAY_US);
             }
-
-          /* Otherwise, spin-wait is enough. */
+          else
+            {
+              UP_WFE();
+            }
         }
     }
 
@@ -739,6 +741,7 @@ static inline_function void hrtimer_process(uint64_t now)
         }
 
       hrtimer_unmark_running(cpu);
+      UP_SEV();
     }
 
   /* Release the lock and give up the ownership of the hrtimer queue. */

Reply via email to