mirror of
https://github.com/apache/nuttx.git
synced 2026-08-26 11:50:50 +00:00
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 <ouyangxiangzhen@xiaomi.com>
This commit is contained in:
parent
7b67055150
commit
54dfa46c09
3 changed files with 13 additions and 22 deletions
|
|
@ -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.
|
||||
****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue