target C {
coordination: decentralized,
scheduler: GEDF_NP,
}
reactor Pi {
input trigger: bool
output out: int
reaction(trigger) -> out {=
tag_t now = lf_tag();
lf_print("***** at tag " PRINTF_TAG, now.time - lf_time_start(), now.microstep);
lf_set(out, 42);
=} STP (30 s) {=
tag_t now = lf_tag();
lf_print_error_and_exit("STP violation at Pi at tag " PRINTF_TAG, now.time - lf_time_start(), now.microstep);
=}
}
reactor Gather {
input[4] in: int
output next: bool
logical action a
state count: int = 0
reaction(startup, a) -> next {=
lf_set(next, true);
=}
reaction(in) -> a {=
tag_t now = lf_tag();
for (int i = 0; i < 4; i++) {
if (!in[i]->is_present) {
lf_print_error_and_exit("Missing input %d in Gather at tag " PRINTF_TAG,
i, now.time - lf_time_start(), now.microstep);
}
}
lf_print("%d: at tag " PRINTF_TAG, self->count, now.time - lf_time_start(), now.microstep);
self->count++;
if (self->count == 4) {
lf_request_stop();
}
lf_schedule(a, 0);
=} STP (30 s) {=
tag_t now = lf_tag();
lf_print_error_and_exit("STP violation at Gather at tag " PRINTF_TAG, now.time - lf_time_start(), now.microstep);
=}
reaction(shutdown) {=
if (self->count < 5) {
lf_print_error_and_exit("Gather received only %d inputs. Expected at least 5.", self->count);
}
=}
}
federated reactor {
pi = new[4] Pi()
g = new Gather()
pi.out -> g.in
(g.next)+ -> pi.trigger
}
The following example, which is identical to the one in issue #473 except that it specifies the
GEDF_NPscheduler, deadlocks: