From ef2f3d7f2d391f3aa7c6e05df7c0ebfe25fcb4dd Mon Sep 17 00:00:00 2001 From: Steven Date: Fri, 29 Apr 2022 10:25:30 -0700 Subject: [PATCH] fix set executing_reaction in self struct --- org.lflang/src/lib/c/reactor-c | 2 +- test/C/src/DeadlineAnytime.lf | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 test/C/src/DeadlineAnytime.lf diff --git a/org.lflang/src/lib/c/reactor-c b/org.lflang/src/lib/c/reactor-c index 905bba6fc1..0455ca2a0c 160000 --- a/org.lflang/src/lib/c/reactor-c +++ b/org.lflang/src/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit 905bba6fc177c97757c964faaf6859a21e246156 +Subproject commit 0455ca2a0c25da0a8c38de61483dbd47ff63f908 diff --git a/test/C/src/DeadlineAnytime.lf b/test/C/src/DeadlineAnytime.lf new file mode 100644 index 0000000000..5b42de7ba9 --- /dev/null +++ b/test/C/src/DeadlineAnytime.lf @@ -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(); +} +