Skip to content

Commit

Permalink
Do not check MIN_SLEEP_DURATION when waiting for the physical time to…
Browse files Browse the repository at this point in the history
… exceed the next tag
  • Loading branch information
byeonggiljun committed Jan 29, 2025
1 parent fd7bd22 commit 184b55f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
8 changes: 0 additions & 8 deletions core/threaded/reactor_threaded.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,6 @@ bool wait_until(instant_t wait_until_time, lf_cond_t* condition) {
LF_PRINT_DEBUG("-------- Waiting until physical time " PRINTF_TIME, wait_until_time - start_time);
// Check whether we actually need to wait, or if we have already passed the timepoint.
interval_t wait_duration = wait_until_time - lf_time_physical();
if (wait_duration < MIN_SLEEP_DURATION) {
LF_PRINT_DEBUG("Wait time " PRINTF_TIME " is less than lf_min_sleep_duration " PRINTF_TIME
". Performing busy wait.",
wait_duration, MIN_SLEEP_DURATION);
while (lf_time_physical() < wait_until_time) {
// Busy wait
}
}

// We do the sleep on the cond var so we can be awakened by the
// asynchronous scheduling of a physical action. lf_clock_cond_timedwait
Expand Down
4 changes: 1 addition & 3 deletions include/core/threaded/reactor_threaded.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ void lf_synchronize_with_other_federates(void);
* if that event time matches or exceeds the specified time.
*
* The mutex lock associated with the condition argument is assumed to be held by
* the calling thread. This mutex is released while waiting. If the wait time is
* too small (less than MIN_SLEEP_DURATION) to wait using lf_clock_cond_timedwait,
* then this function performs busy wait and the mutex is not released.
* the calling thread.
*
* @param env Environment within which we are executing.
* @param wait_until_time The time to wait until physical time matches it.
Expand Down

0 comments on commit 184b55f

Please sign in to comment.