sched/wdog:change g_wdtickbase update situation.

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 <yangguangcai@xiaomi.com>
This commit is contained in:
yangguangcai 2023-08-25 20:56:24 +08:00 committed by Xiang Xiao
parent 6ac28d5526
commit fe30f0fa82

View File

@ -373,6 +373,10 @@ unsigned int wd_timer(int ticks, bool noswitches)
unsigned int ret; unsigned int ret;
int decr; int decr;
/* Update clock tickbase */
g_wdtickbase += ticks;
/* Check if there are any active watchdogs to process */ /* Check if there are any active watchdogs to process */
wdog = (FAR struct wdog_s *)g_wdactivelist.head; wdog = (FAR struct wdog_s *)g_wdactivelist.head;
@ -386,7 +390,6 @@ unsigned int wd_timer(int ticks, bool noswitches)
wdog->lag -= decr; wdog->lag -= decr;
ticks -= decr; ticks -= decr;
g_wdtickbase += decr;
wdog = wdog->next; wdog = wdog->next;
} }
@ -398,10 +401,6 @@ unsigned int wd_timer(int ticks, bool noswitches)
wd_expiration(); wd_expiration();
} }
/* Update clock tickbase */
g_wdtickbase += ticks;
/* Return the delay for the next watchdog to expire */ /* Return the delay for the next watchdog to expire */
ret = g_wdactivelist.head ? ret = g_wdactivelist.head ?