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

Support zero-delay cycles #468

Open
wants to merge 27 commits into
base: transient-fed
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
fea2eed
Support zero-delay cycles
edwardalee Jul 15, 2024
7fd3ce5
Fix the type of _lf_zero_delay_cycle_action_table_size iterator to be…
ChadliaJerad Jul 15, 2024
ac14760
Removed unnecessary parens
edwardalee Jul 15, 2024
ec5b2d6
Run clang formatter
ChadliaJerad Jul 17, 2024
322dde6
Fixed thread interactions
edwardalee Jul 17, 2024
da02bb6
Format
edwardalee Jul 17, 2024
e902d3f
Fix mutex access in lf_delayed_grants()
ChadliaJerad Jul 18, 2024
c7ea64d
Made functions static and use free function for queue
edwardalee Jul 18, 2024
46abf8c
Added max function
edwardalee Jul 19, 2024
8c85e1f
Revert to holding mutex plus general cleanups
edwardalee Jul 19, 2024
60282e5
Hold mutex and notify downstream not upstream
edwardalee Jul 19, 2024
e97a619
Merge branch 'transient-fed' into transient-fed-cycles
ChadliaJerad Jul 24, 2024
291d7fb
Fix the pqueue tag iterator type
ChadliaJerad Jul 24, 2024
71a4cb6
Fix condition 2 for computing the effective start time of a transient…
ChadliaJerad Jul 24, 2024
5ef6b54
Update lingua-franca-ref.txt
ChadliaJerad Jul 24, 2024
d41a6a4
Revert to 0 microstep
edwardalee Jul 27, 2024
07f3671
Merge branch 'transient-fed' into transient-fed-cycles
ChadliaJerad Aug 7, 2024
6c20e64
Fix lf_get_federates_bin_directory() + Fix its scope, as well as lf_g…
ChadliaJerad Aug 7, 2024
286931d
Remove no more needed LF_FEDERATED_BIN_DIRECTORY
ChadliaJerad Aug 7, 2024
6b55db0
Run Clang formatter
ChadliaJerad Aug 7, 2024
f00c5af
Merge branch 'transient-fed' into transient-fed-cycles
ChadliaJerad Aug 14, 2024
e8c930d
Remove overlooked code when merging
ChadliaJerad Aug 14, 2024
960307e
Handle corner cases where connection messages about transients are re…
ChadliaJerad Aug 21, 2024
d543cc7
Reset timing info from previous runs
ChadliaJerad Aug 21, 2024
2981542
Skip checking the satet in the first call of _update_min_delays_upsteam
ChadliaJerad Aug 21, 2024
7b7c01f
Invalidate min delays of all federates once a tansient joins
ChadliaJerad Aug 28, 2024
859a078
Do not skip the node itself in _updat_min_delays
ChadliaJerad Aug 28, 2024
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
8 changes: 5 additions & 3 deletions core/federated/RTI/rti_remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -2307,17 +2307,19 @@ void* lf_connect_to_transient_federates_thread(void* nothing) {
*/
void* lf_delayed_grants_thread(void* nothing) {
initialize_lf_thread_id();
// Hold the mutex except while waiting.
LF_MUTEX_LOCK(&rti_mutex);
// Hold the mutex only when accessing rti_remote->delayed_grants pqueue
while (!rti_remote->all_federates_exited) {
if (pqueue_delayed_grants_size(rti_remote->delayed_grants) > 0) {
// Do not pop, but rather peek.
LF_MUTEX_LOCK(&rti_mutex);
pqueue_delayed_grant_element_t* next = pqueue_delayed_grants_peek(rti_remote->delayed_grants);
instant_t next_time = next->base.tag.time;
LF_MUTEX_UNLOCK(&rti_mutex);
// Wait for expiration, or a signal to stop or terminate.
if (lf_clock_cond_timedwait(&updated_delayed_grants, next_time)) {
// Time reached to send the grant.
// However, the grant may have been canceled while we were waiting.
LF_MUTEX_LOCK(&rti_mutex);
pqueue_delayed_grant_element_t* new_next = pqueue_delayed_grants_peek(rti_remote->delayed_grants);
if (next == new_next) {
pqueue_delayed_grants_pop(rti_remote->delayed_grants);
Expand All @@ -2330,6 +2332,7 @@ void* lf_delayed_grants_thread(void* nothing) {
free(next);
}
}
LF_MUTEX_UNLOCK(&rti_mutex);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This unlock may occur with no matching lock.

} else if (pqueue_delayed_grants_size(rti_remote->delayed_grants) == 0) {
// Wait for something to appear on the queue.
lf_cond_wait(&updated_delayed_grants);
Expand All @@ -2340,7 +2343,6 @@ void* lf_delayed_grants_thread(void* nothing) {
pqueue_delayed_grant_element_t* next = pqueue_delayed_grants_pop(rti_remote->delayed_grants);
free(next);
}
LF_MUTEX_UNLOCK(&rti_mutex);
return NULL;
}

Expand Down
Loading