ostest/wdog: Fix a synchronizing bug.

If we updated `callback_cnt` before the `triggered_tick` in the wdog timer callback, the `wdtest_rand` might failed randomly. This commit fixed the synchronizing bug by swapping the execution order of updating.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit is contained in:
ouyangxiangzhen 2025-05-26 21:07:14 +08:00 committed by Xiang Xiao
parent 69bfda8736
commit 62fe1a3ac5

View file

@ -70,13 +70,13 @@ static void wdtest_callback(wdparm_t param)
{
FAR wdtest_param_t *wdtest_param = (FAR wdtest_param_t *)param;
/* Increment the callback count */
wdtest_param->callback_cnt += 1;
/* Record the system tick at which the callback was triggered */
wdtest_param->triggered_tick = clock_systime_ticks();
/* Increment the callback count */
wdtest_param->callback_cnt += 1;
}
static void wdtest_checkdelay(sclock_t diff, sclock_t delay_tick)