Replies: 4 comments 10 replies
-
I believe the answer to both of these is "yes." There is an interesting (awkward) corner case if there are any startup reactions that are defined after shutdown reactions (in the same reactor).
One way to explain this behavior is the following slightly modified version of the text in the handbook: The target property timeout specifies the last logical time at which a program stop is requested, meaning the last invocation of reactions will be at tag (timeout, 1).
Sorry, I didn't understand this question.
If we were to, there are plausible scenarios in which execution would continue on for an arbitrary number of iterations in superdense time, rendering the semantics of timeout a lot less useful, IMO.
I think the idea was that startup and shutdown would be present logically simultaneous in this case. While this makes sense, this opens up the possibility of the corner case I described above, where a reaction triggered by
I think it is. It basically specifies to allow reactions for a single tag only.
That doesn't seem useful to me, as the same can be achieved by not specifying a timeout at all. |
Beta Was this translation helpful? Give feedback.
-
There is also a federated aspect to this. Also, having a dedicated top-level reactor for timeout would be slightly strange in federated execution because the timeout reactor will become its own federate. |
Beta Was this translation helpful? Give feedback.
-
As Marten pointed out, I was not proposing to modify the implementation of timeout such that we use
I meant later, not earlier ;). The behaviour of
This is true if you only consider the timeout property. But in C++ we also have the CLI option (I believe in C as well?) that allows to overwrite the timeout. But how do you switch off the timeout from the CLI for a program that has the timeout property set? I find |
Beta Was this translation helpful? Give feedback.
-
I'd also like to suggest that we can easily detect the corner case that I described: if timeout is set to zero and there are shutdown reactions defined before startup reactions, we can issue a warning. We currently don't do this, but perhaps we should. |
Beta Was this translation helpful? Give feedback.
-
I am unsure about what the correct behaviour for the timeout target property is (See #725 for some context). The more I think about it the more I am wondering if the current specification makes sense.
The hanbook says:
Apparently, the C target implements this such that shutdown is triggered at (timeout, 0) (correct?). Are all other events with (timeout, 0) also triggered and reactions invoked for this tag? The C++ runtime implements this differently and there is a discrepancy between behaviours. In C++, the C++ runtime currently executes all reactions at tag (timeout, 0) and then triggers shutdown in the next microstep (timeout, 1)
In this context, I am questioning what the right behaviour should be. If
request_stop()
triggers shutdown at the next microstep, shouldn't also timout trigger shutdown one microstep earlier? Also, why do we execute all reactions at (timeout, 0), but not at (timeout, N) (with N>0)?Also I am wondering what the meaning of a timeout of 0 should be. Apparently, in C, this immediately stops the execution. But is this a reasonable behaviour? In C++, timeout=0 simply means there is no timeout and the program runs forever. To me this seems very intuitive, but again there is a discrepancy between targets and we might want to unify this.
So, what are your thoughts?
Beta Was this translation helpful? Give feedback.
All reactions