handle Fatal exception
Chris Johns
chrisj at rtems.org
Mon Aug 31 23:08:17 UTC 2020
On 1/9/20 4:39 am, Ярослав Лещинский wrote:
> Can someone suggest what is a right way to program a watchdog in a
> multithreading environment? For example, I have a watchdog which can reboot the
> system if a freeze flag is detected. This flag is setted up in a general task
> which is executed periodically. But I'm not sure first -- that it's a correct
> place (maybe it's better to do that during a context switching) and second -- in
> case of a freeze of only single thread it would restart the whole system.
Checking for something locking up when you can pre-empt requires a little more
thought and design. For example you may have a lower priority task that is stuck
looping while your monitored task as a higher priority is fine.
A simple design has the tasks you wish to monitor ask for a token when they are
about to do some work. The task returns the token when finished. A high priority
task monitors the active tokens and if there are no outstanding tokens the
watchdog hardware is toggled.
Chris
More information about the users
mailing list