Is this watchdog correct?

Hi, I have a implementation of a watchdog. It regularly checks if the last tick was |a long time ago". If yes, it stops the process. Is this implementation correct?
playground
I know that this timeout is not accurate, but that is ok for my use case.
Yes, I know this is a XY problem, but I am still curious if I understand Rust threads and processes correctly.

If you're happy for the process to exit immediately if a timeout occurs (so main() will not get a chance to exit cleanly), then yes, the code is correct.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.