Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Immediate start of federates with STA offset under decentralized coordination #469

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions core/threaded/reactor_threaded.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,16 +615,15 @@ void _lf_initialize_start_tag(environment_t* env) {

#if defined FEDERATED_DECENTRALIZED
// If we have a non-zero STA offset, then we need to allow messages to arrive
// prior to the start time. To avoid spurious STP violations, we temporarily
// at the start time. To avoid spurious STP violations, we temporarily
// set the current time back by the STA offset.
env->current_tag.time -= lf_fed_STA_offset;
LF_PRINT_LOG("Waiting for start time " PRINTF_TIME " plus STA " PRINTF_TIME ".", start_time, lf_fed_STA_offset);
#else
// For other than federated decentralized execution, there is no lf_fed_STA_offset variable defined.
// To use uniform code below, we define it here as a local variable.
instant_t lf_fed_STA_offset = 0;
LF_PRINT_LOG("Waiting for start time " PRINTF_TIME ".", start_time);
#endif
LF_PRINT_LOG("Waiting for start time " PRINTF_TIME ".", start_time);

// Call wait_until if federated. This is required because the startup procedure
// in lf_synchronize_with_other_federates() can decide on a new start_time that is
Expand All @@ -643,7 +642,7 @@ void _lf_initialize_start_tag(environment_t* env) {
// Here we wait until the start time and also release the environment mutex.
// this means that the other worker threads will be allowed to start. We need
// this to avoid potential deadlock in federated startup.
while (!wait_until(start_time + lf_fed_STA_offset, &env->event_q_changed)) {
while (!wait_until(start_time, &env->event_q_changed)) {
};
LF_PRINT_DEBUG("Done waiting for start time + STA offset " PRINTF_TIME ".", start_time + lf_fed_STA_offset);
LF_PRINT_DEBUG("Physical time is ahead of current time by " PRINTF_TIME ". This should be close to the STA offset.",
Expand Down
Loading