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

Patch to ensure that deadlines with zero delay are never met #86

Merged
merged 9 commits into from
Jun 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/reactor.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ int _lf_do_step(void) {
// at most once per logical time value. If the violation reaction triggers the
// same reaction at the current time value, even if at a future superdense time,
// then the reaction will be invoked and the violation reaction will not be invoked again.
if (reaction->deadline > 0LL) {
if (reaction->deadline >= 0LL) {
// Get the current physical time.
instant_t physical_time = lf_time_physical();
// FIXME: These comments look outdated. We may need to update them.
Expand All @@ -210,7 +210,7 @@ int _lf_do_step(void) {
// container deadlines are defined in the container.
// They can have different deadlines, so we have to check both.
// Handle the local deadline first.
if (physical_time > current_tag.time + reaction->deadline) {
if (reaction->deadline == 0 || physical_time > current_tag.time + reaction->deadline) {
LF_PRINT_LOG("Deadline violation. Invoking deadline handler.");
// Deadline violation has occurred.
violation = true;
Expand Down
4 changes: 2 additions & 2 deletions core/reactor_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1681,11 +1681,11 @@ void schedule_output_reactions(reaction_t* reaction, int worker) {
}
}
#endif
if (downstream_to_execute_now->deadline > 0LL) {
if (downstream_to_execute_now->deadline >= 0LL) {
// Get the current physical time.
instant_t physical_time = lf_time_physical();
// Check for deadline violation.
if (physical_time > current_tag.time + downstream_to_execute_now->deadline) {
if (downstream_to_execute_now->deadline == 0 || physical_time > current_tag.time + downstream_to_execute_now->deadline) {
// Deadline violation has occurred.
violation = true;
// Invoke the local handler, if there is one.
Expand Down
4 changes: 2 additions & 2 deletions core/threaded/reactor_threaded.c
Original file line number Diff line number Diff line change
Expand Up @@ -861,11 +861,11 @@ bool _lf_worker_handle_deadline_violation_for_reaction(int worker_number, reacti
// at most once per logical time value. If the violation reaction triggers the
// same reaction at the current time value, even if at a future superdense time,
// then the reaction will be invoked and the violation reaction will not be invoked again.
if (reaction->deadline > 0LL) {
if (reaction->deadline >= 0LL) {
// Get the current physical time.
instant_t physical_time = lf_time_physical();
// Check for deadline violation.
if (physical_time > current_tag.time + reaction->deadline) {
if (reaction->deadline == 0 || physical_time > current_tag.time + reaction->deadline) {
// Deadline violation has occurred.
violation_occurred = true;
// Invoke the local handler, if there is one.
Expand Down
2 changes: 1 addition & 1 deletion lingua-franca-ref.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
544168274369b9d3893695846171bd2ed43d4682
25e67092a31bb30811a7907bc2b8644b9a2d2b43