lingua-franca icon indicating copy to clipboard operation
lingua-franca copied to clipboard

Reaction to enclave output does not compile

Open edwardalee opened this issue 7 months ago • 1 comments

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.

Image

 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);
  =}
}

edwardalee avatar Apr 18 '25 18:04 edwardalee

Transferred the issue as it appears to be a code generator problem and not related to the runtime.

cmnrd avatar May 20 '25 12:05 cmnrd