wangchdo commented on code in PR #17295:
URL: https://github.com/apache/nuttx/pull/17295#discussion_r2507912771


##########
include/nuttx/wdog.h:
##########
@@ -143,6 +143,40 @@ extern "C"
 int wd_start(FAR struct wdog_s *wdog, clock_t delay,
              wdentry_t wdentry, wdparm_t arg);
 
+/****************************************************************************
+ * Name: wd_reload
+ *
+ * Description:
+ *   This function restarts (reloads) an already-started watchdog timer
+ *   with a new delay time, without modifying its existing handler function
+ *   or argument.
+ *
+ *   It behaves similarly to wd_start(), but is typically used when the
+ *   watchdog has already been started and needs to be rearmed before it
+ *   expires. The same watchdog function (wdog->func) will be called from
+ *   the interrupt level after the specified number of ticks has elapsed.
+ *
+ *   Watchdog timers may be started or reloaded from the interrupt level.
+ *   Watchdog timers execute in the address environment that was in effect
+ *   when wd_reload() is called.
+ *   Watchdog timers execute only once.
+ *
+ * Input Parameters:
+ *   wdog   - Watchdog ID
+ *   delay  - Delay count in clock ticks
+ *
+ * Returned Value:
+ *   Zero (OK) is returned on success; a negated errno value is returned to
+ *   indicate the nature of any failure.
+ *
+ * Assumptions:
+ *   The watchdog routine runs in the context of the timer interrupt handler
+ *   and is subject to all ISR restrictions.
+ *
+ ****************************************************************************/
+
+int wd_reload(FAR struct wdog_s *wdog, clock_t delay);

Review Comment:
   Ah, I see — I didn’t notice that earlier.
   
   However, do you think it would make sense to provide an API that allows 
restarting the watchdog without requiring the user to pass the entry function, 
parameters and delay again?
   It would make the interface more convenient and align better with common 
usage scenarios.
   
   I have uploaded an amend for this.
   
   Below is the comparison of these two apis:
   
   ```
   int wd_reload(FAR struct wdog_s *wdog);
   int wd_start_next(FAR struct wdog_s *wdog, clock_t delay,
                     wdentry_t wdentry, wdparm_t arg);
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to