Skip to content

Commit

Permalink
sched/wdog:change g_wdtickbase update situation.
Browse files Browse the repository at this point in the history
In the 'wd_timer',the callback function executed by 'wd_expiration' could call wd_start,and g_wdtickbase might be updated.Subsequently, g_wdtickbase is incremented by the value of ticks, causing g_wdtickbase to be greater than the actual passage of time.

Signed-off-by: yangguangcai <[email protected]>
  • Loading branch information
yangguangcai1 authored and xiaoxiang781216 committed Sep 19, 2023
1 parent 6ac28d5 commit fe30f0f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions sched/wdog/wd_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@ unsigned int wd_timer(int ticks, bool noswitches)
unsigned int ret;
int decr;

/* Update clock tickbase */

g_wdtickbase += ticks;

/* Check if there are any active watchdogs to process */

wdog = (FAR struct wdog_s *)g_wdactivelist.head;
Expand All @@ -386,7 +390,6 @@ unsigned int wd_timer(int ticks, bool noswitches)

wdog->lag -= decr;
ticks -= decr;
g_wdtickbase += decr;

wdog = wdog->next;
}
Expand All @@ -398,10 +401,6 @@ unsigned int wd_timer(int ticks, bool noswitches)
wd_expiration();
}

/* Update clock tickbase */

g_wdtickbase += ticks;

/* Return the delay for the next watchdog to expire */

ret = g_wdactivelist.head ?
Expand Down

0 comments on commit fe30f0f

Please sign in to comment.