Fix-Point commented on code in PR #16481: URL: https://github.com/apache/nuttx/pull/16481#discussion_r2135264571
########## include/nuttx/wdog.h: ########## @@ -320,8 +314,19 @@ static inline int wd_start_realtime(FAR struct wdog_s *wdog, * ****************************************************************************/ -int wd_start_period(FAR struct wdog_period_s *wdog, clock_t delay, - clock_t period, wdentry_t wdentry, wdparm_t arg); +static inline_function +int wd_start_next(FAR struct wdog_s *wdog, clock_t delay, Review Comment: The previous `wd_start_period()` implementation added more internal states to the wdog module, making it less reliable. Instead, `wd_start_next` is designed to replace the `wd_start` inside the wdog callback to achieve precise timing. The most common implementation of periodic wdog in NuttX kernel is to start the next one through `wd_start` in the callback, which would cause the accumulation of timing errors, while `wd_start_next` would not. This API is very easy to use. Just replace the `wd_start` with the `wd_start_next` in the wdog callback, you can get the exact periodical timer, as commit `71dff46e38c93a4c5455a688266ae55041e2f4d4` showed. In addition, it should be possible using the similar API to implement periodical work-queue. So we have commit `6a4bfda9376f97e6d869493eda053dddf0b3f500`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org