diff options
Diffstat (limited to 'nuttx/sched/wdog/wd_start.c')
-rw-r--r-- | nuttx/sched/wdog/wd_start.c | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/nuttx/sched/wdog/wd_start.c b/nuttx/sched/wdog/wd_start.c index 8488eb898..6ba19da39 100644 --- a/nuttx/sched/wdog/wd_start.c +++ b/nuttx/sched/wdog/wd_start.c @@ -233,9 +233,6 @@ int wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry, int argc, ...) FAR wdog_t *next; int32_t now; irqstate_t saved_state; -#ifdef CONFIG_SCHED_TICKLESS - bool reassess = false; -#endif int i; /* Verify the wdog */ @@ -288,6 +285,16 @@ int wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry, int argc, ...) delay--; } +#ifdef CONFIG_SCHED_TICKLESS + /* Cancel the interval timer that drives the timing events. This will cause + * wd_timer to be called which update the delay value for the first time + * at the head of the timer list (there is a possibility that it could even + * remove it). + */ + + (void)sched_timer_cancel(); +#endif + /* Do the easy case first -- when the watchdog timer queue is empty. */ if (g_wdactivelist.head == NULL) @@ -295,14 +302,6 @@ int wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry, int argc, ...) /* Add the watchdog to the head == tail of the queue. */ sq_addlast((FAR sq_entry_t*)wdog, &g_wdactivelist); - -#ifdef CONFIG_SCHED_TICKLESS - /* Whenever the watchdog at the head of the queue changes, then we - * need to reassess the interval timer setting. - */ - - reassess = true; -#endif } /* There are other active watchdogs in the timer queue */ @@ -348,14 +347,6 @@ int wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry, int argc, ...) /* Insert the watchdog at the head of the list */ sq_addfirst((FAR sq_entry_t*)wdog, &g_wdactivelist); - -#ifdef CONFIG_SCHED_TICKLESS - /* If the watchdog at the head of the queue changes, then we - * need to reassess the interval timer setting. - */ - - reassess = true; -#endif } else { @@ -395,17 +386,12 @@ int wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry, int argc, ...) wdog->active = true; #ifdef CONFIG_SCHED_TICKLESS - /* Reassess the interval timer that will generate the next interval event. - * In many cases, this will be unnecessary: This is really only necessary - * when the watchdog timer at the head of the queue is change. If the - * timer is inserted later in the queue then the timer at the head is - * unchanged. + /* Resume the interval timer that will generate the next interval event. + * If the timer at the head of the list changed, then this will pick that + * new delay. */ - if (reassess) - { - sched_timer_reassess(); - } + sched_timer_resume(); #endif irqrestore(saved_state); |