Skip to content

Commit

Permalink
Merge pull request #1126 from lf-lang/test-check-deadline
Browse files Browse the repository at this point in the history
Fix set executing_reaction in self struct
  • Loading branch information
lhstrh authored Apr 30, 2022
2 parents 1bf059b + ef2f3d7 commit 508315f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion org.lflang/src/lib/c/reactor-c
30 changes: 30 additions & 0 deletions test/C/src/DeadlineAnytime.lf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Test whether the lf_check_deadline function works.
target C;

reactor A {
state i:int;
logical action a;
reaction(startup) -> a {=
self->i = 0;
while (!lf_check_deadline(self, true));
=} deadline(10 msec) {=
lf_schedule(a, 0);
=}

reaction(a) {=
self->i = 42;
=}

reaction(shutdown) {=
if (self->i == 42) {
printf("SUCCESS\n");
} else {
error_print_and_exit("Expected 42, but got %d", self->i);
}
=}
}

main reactor {
a = new A();
}

0 comments on commit 508315f

Please # to comment.