-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2338 from lf-lang/modes-with-microsteps
Fixed bug in modes with microsteps
- Loading branch information
Showing
2 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
Submodule reactor-c
updated
7 files
+9 −2 | core/federated/RTI/rti_remote.c | |
+1 −1 | core/modal_models/modes.c | |
+2 −0 | core/reactor.c | |
+2 −0 | core/reactor_common.c | |
+2 −0 | core/threaded/reactor_threaded.c | |
+1 −1 | core/utils/pqueue_tag.c | |
+4 −2 | include/core/tracepoint.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* When in the Primary mode, the watchdog is sure to trigger, causing the reaction to watcher to be | ||
* executed one microstep later. Previously, after a mode transition, the microstep was hardwired to | ||
* 1, which caused a fatal error after the mode transition when the runtime tried to advance to | ||
* microstep 1 and found that it was already at microstep 1. This program tests that this is fixed. | ||
* Success is simply running to completion without error. | ||
*/ | ||
target C { | ||
keepalive: true, | ||
timeout: 1 s | ||
} | ||
|
||
reactor Arbitrator(timeout: time = 100 ms) { | ||
input in1: double | ||
input in2: double | ||
|
||
watchdog watcher(timeout) {= lf_print("watchdog timeout."); =} | ||
|
||
initial mode Primary { | ||
reaction(in1) -> watcher {= | ||
lf_watchdog_start(watcher, 0); | ||
=} | ||
|
||
reaction(watcher) -> reset(Backup) {= | ||
lf_print("watchdog reaction."); | ||
lf_set_mode(Backup); | ||
=} | ||
} | ||
|
||
mode Backup { | ||
reaction(in2) -> watcher {= | ||
lf_watchdog_start(watcher, 0); | ||
=} | ||
} | ||
} | ||
|
||
main reactor { | ||
timer t(0, 100 ms) | ||
|
||
ar = new Arbitrator() | ||
|
||
reaction(t) -> ar.in1, ar.in2 {= | ||
lf_set(ar.in1, 0.0); | ||
lf_set(ar.in2, 0.0); | ||
=} | ||
} |