lingua-franca
lingua-franca copied to clipboard
Reaction to enclave output does not compile
The following program has a reaction to the output of a contained enclave. It fails to compile. One fix would be to update the validator to prohibit such structures. Interestingly, the same structure works in the C target, but the logical time of the reaction to the enclave output is nondeterministic. So I think it would be legitimate to disallow such structures in the C target as well.
target Cpp{
timeout: 2 sec
}
reactor BlockingReactor {
output out: int
timer t(0, 1 s)
reaction(t) -> out {=
reactor::log::Info() << ("Blocking reactor invoked\n");
std::this_thread::sleep_for(1s);
reactor::log::Info() << ("Blocking reactor sending output\n");
out.set(42);
=}
}
main reactor {
timer t(0, 100 ms)
@enclave
blocking = new BlockingReactor()
// Logical time of this reaction is nondeterministic.
reaction(blocking.out) {=
reactor::log::Info() << "Main reactor received enclave output at tag (" << get_elapsed_logical_time() << ", " << get_microstep() << ")\n";
=}
reaction(t) {=
reactor::log::Info() << "Tick at tag (" << get_elapsed_logical_time() << ", " << get_microstep() << ")\n";
=} deadline(200 ms) {=
reactor::log::Error() << ("Main reactor deadline was violated!\n");
exit(1);
=}
}
Transferred the issue as it appears to be a code generator problem and not related to the runtime.