Open edwardalee opened 4 months ago
How should watchdogs in modes behave? I think they have to follow the semantics of modal reactors. Consider a mode switch from First
-> Second
. Any watchdog in First
will have to be "freezed". What happens in Second
depends on the transition. A reset transition is easy, then the watchdog is not started, this will have to be done in a reaction within the mode. But a history transition is more tricky, should the watchdog consider the global logical time, or the local time in the mode? If we consider local time, then we might immediately get a watchdog timeout when we enable the watchdog again since local time is freezed when not in the mode. Also, I think it will be quite tricky to access this "local time" from our watchdog implementation.
If we consider global time then it is a little easier, but I am not sure it makes that much sense. The watchdog will then basically "guard" how much time is spent in another mode, but it will not trigger until finally the mode is entered again. Then it is too late to do anything anyway.
We could reject programs with history transitions to a mode with watchdogs. Or are there other use cases for it?
I have come to the (tentative) conclusion that we don't actually need watchdogs if we have enclaves. I think the watchdog can be effectively implemented using an enclave. So maybe we shouldn't worry too much about this.
It should be possible for a watchdog to be defined and used within a mode, but this does not currently work. The validator cannot resolve references to the watchdog, although I suspect this is only the first level problem. Test case:
It should also be possible for a watchdog that is defined at reactor scope to have a handler that changes modes, but this also fails validation: