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

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

commit 54dfa46c09295ece70bad260fc87162fc7e04813
Author: ouyangxiangzhen <[email protected]>
AuthorDate: Thu Jan 15 14:47:12 2026 +0800

    sched/hrtimer: Rename the hrtimer_is_armed.
    
    This commit renamed the hrtimer_is_armed to hrtimer_is_pending, which is
    more accurate in the semamtic, and simplify it.
    
    Signed-off-by: ouyangxiangzhen <[email protected]>
---
 sched/hrtimer/hrtimer.h        | 31 +++++++++++--------------------
 sched/hrtimer/hrtimer_cancel.c |  2 +-
 sched/hrtimer/hrtimer_start.c  |  2 +-
 3 files changed, 13 insertions(+), 22 deletions(-)

diff --git a/sched/hrtimer/hrtimer.h b/sched/hrtimer/hrtimer.h
index 2b6386910bd..0a989c714b6 100644
--- a/sched/hrtimer/hrtimer.h
+++ b/sched/hrtimer/hrtimer.h
@@ -45,6 +45,12 @@
 
 #define HRTIMER_CANCEL_SYNC_DELAY_US CONFIG_USEC_PER_TICK
 
+/* The pending state indicates the timer belongs to the shared hrtimer queue
+ * and is waiting for the next hrtimer expiry.
+ */
+
+#define hrtimer_is_pending(hrtimer)    ((hrtimer)->func != NULL)
+
 /****************************************************************************
  * Public Types
  ****************************************************************************/
@@ -188,26 +194,11 @@ int hrtimer_compare(FAR const hrtimer_node_t *a,
 RB_PROTOTYPE(hrtimer_tree_s, hrtimer_node_s, entry, hrtimer_compare);
 #endif
 
-/****************************************************************************
- * Name: hrtimer_is_armed
- *
- * Description:
- *   Test whether a timer is currently armed (inserted into the container).
- *
- * Returned Value:
- *   true if armed, false otherwise.
- ****************************************************************************/
-
-static inline_function bool hrtimer_is_armed(FAR hrtimer_t *hrtimer)
-{
-  return hrtimer->func != NULL;
-}
-
 /****************************************************************************
  * Name: hrtimer_remove
  *
  * Description:
- *   Remove a timer from the container and mark it as unarmed.
+ *   Remove a timer from the queue and mark it as dequeued.
  ****************************************************************************/
 
 static inline_function void hrtimer_remove(FAR hrtimer_t *hrtimer)
@@ -218,7 +209,7 @@ static inline_function void hrtimer_remove(FAR hrtimer_t 
*hrtimer)
   list_delete_fast(&hrtimer->node.entry);
 #endif
 
-  /* Explicitly mark the timer as unarmed */
+  /* Explicitly mark the timer as dequeued. */
 
   hrtimer->func = NULL;
 }
@@ -257,10 +248,10 @@ static inline_function void hrtimer_insert(FAR hrtimer_t 
*hrtimer)
  * Name: hrtimer_get_first
  *
  * Description:
- *   Return the earliest expiring armed timer.
+ *   Return the earliest expiring pending timer.
  *
  * Returned Value:
- *   Pointer to the earliest timer, or NULL if none are armed.
+ *   Pointer to the earliest timer, or NULL if none are pending.
  ****************************************************************************/
 
 static inline_function FAR hrtimer_t *hrtimer_get_first(void)
@@ -287,7 +278,7 @@ static inline_function FAR hrtimer_t 
*hrtimer_get_first(void)
  *   hrtimer - Pointer to the high-resolution timer to be tested.
  *
  * Returned Value:
- *   true  - The timer is the earliest expiring armed timer.
+ *   true  - The timer is the earliest expiring pending timer.
  *   false - The timer is not the earliest timer.
  ****************************************************************************/
 
diff --git a/sched/hrtimer/hrtimer_cancel.c b/sched/hrtimer/hrtimer_cancel.c
index 0415511bead..62833e5ccf8 100644
--- a/sched/hrtimer/hrtimer_cancel.c
+++ b/sched/hrtimer/hrtimer_cancel.c
@@ -91,7 +91,7 @@ int hrtimer_cancel(FAR hrtimer_t *hrtimer)
 
   ret = hrtimer_cancel_running(hrtimer);
 
-  if (hrtimer_is_armed(hrtimer))
+  if (hrtimer_is_pending(hrtimer))
     {
       hrtimer_remove(hrtimer);
 
diff --git a/sched/hrtimer/hrtimer_start.c b/sched/hrtimer/hrtimer_start.c
index 8c876ad6093..b5d9f1b21d1 100644
--- a/sched/hrtimer/hrtimer_start.c
+++ b/sched/hrtimer/hrtimer_start.c
@@ -75,7 +75,7 @@ int hrtimer_start_absolute(FAR hrtimer_t *hrtimer, 
hrtimer_entry_t func,
 
   hrtimer_cancel_running(hrtimer);
 
-  if (hrtimer_is_armed(hrtimer))
+  if (hrtimer_is_pending(hrtimer))
     {
       hrtimer_remove(hrtimer);
     }

Reply via email to