Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout with value zero has different behaviour in C and Cpp #725

Closed
Rodario opened this issue Nov 5, 2021 · 3 comments · Fixed by #1507
Closed

Timeout with value zero has different behaviour in C and Cpp #725

Rodario opened this issue Nov 5, 2021 · 3 comments · Fixed by #1507
Labels
bug Something isn't working cpp Related to C++ target

Comments

@Rodario
Copy link
Collaborator

Rodario commented Nov 5, 2021

I have ported missing tests from the Cpp to C target and happened on a "bug" in one of them.
The test in question is the TimoutZero test..
My implementation looks like this.

The "bug" is more of a implementation question it seems. A timeout of 0 in Cpp is handled as if there is no timeout where in C there is a termination after the 0th step.
I talked with @cmnrd about this and we wanted to ask, whats the correct behavior here?

@Rodario Rodario added c Related to C target cpp Related to C++ target labels Nov 5, 2021
@Soroosh129
Copy link
Contributor

Soroosh129 commented Nov 5, 2021

Others might want to explain the requirements of the language.

However, from a practical standpoint, is there a way to stop the program at tag (0,0) in the Cpp target?

@cmnrd
Copy link
Collaborator

cmnrd commented Nov 5, 2021

Yes, absolutely. Actually, the C++ runtime does not implement a timeout. Instead, the code generator simply injects a timeout reactor that sets a timer and it's reaction requests to stop the execution. In principle, the delay could be zero.

However, the issue at hand is the interpretation of zero. In C++, a timeout of zero is interpreted as invalid and hence there is no timeout. This is very convenient when using the CLI arguments. We can simply write --timout 0 to disable a timeout.

How does the C runtime handle this? Which value has timeout if there is no timout configured?

@cmnrd cmnrd added the invalid This doesn't seem right label Nov 5, 2021
@Soroosh129
Copy link
Contributor

Instead, the code generator simply injects a timeout reactor that sets a timer and it's reaction requests to stop the execution.

I don't see how with this implementation, a stop tag of (0,0) could be achieved. A request_stop() call should stop the program at least one microstep later.

Which value has timeout if there is no timout configured?

I don't understand this question. Do you mean what the default timeout is? It is infinity by default (or FOREVER to be specific).

@cmnrd cmnrd added bug Something isn't working and removed invalid This doesn't seem right c Related to C target labels Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cpp Related to C++ target
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants