This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 62fe1a3ac504f1e2af410ebbde4c34bb5d5abf2d
Author: ouyangxiangzhen <[email protected]>
AuthorDate: Mon May 26 21:07:14 2025 +0800

    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 <[email protected]>
---
 testing/ostest/wdog.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/testing/ostest/wdog.c b/testing/ostest/wdog.c
index 273a680e9..e64f1246f 100644
--- a/testing/ostest/wdog.c
+++ b/testing/ostest/wdog.c
@@ -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)

Reply via email to