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

Presence of logical action is not reset in C target

Open a-sr opened this issue 8 months ago • 1 comments

After being present once the is_present always returns true even if the logical action did not trigger.

Example:

target C {
    timeout: 7 msecs,
    fast: true
}

main reactor {
    logical action a;
    logical action b;
        
    reaction(startup) -> a {=
        lf_schedule(a, MSEC(1));
    =}

    reaction(a, b) -> a, b {=
        if (a->is_present) {
            printf("A");
            lf_schedule(b, MSEC(2));
        }
        if (b->is_present) {
            printf("B");
            lf_schedule(a, MSEC(1));
        }
        printf(" at %d msecs with triggers (%d,%d)\n", lf_time_logical_elapsed() / MSEC(1), a->is_present, b->is_present);
    =}
}

Output (VS Code v0.7.3):

A at 1 msecs with triggers (1,0)
AB at 3 msecs with triggers (1,1)
AB at 4 msecs with triggers (1,1)
AB at 5 msecs with triggers (1,1)
AB at 6 msecs with triggers (1,1)
AB at 7 msecs with triggers (1,1)

Expected behavior: A and B should alternate with different offsets.

a-sr avatar May 30 '24 15:05 a-sr