Fixed stutter caused by saving by adding a sleep in the saving loop, fixed bug with timers not resuming due to a negative remaining duration

This commit is contained in:
Mr-Wiseguy
2024-04-02 22:16:31 -04:00
parent fcc4eb6351
commit 407b6e547c
4 changed files with 95 additions and 2 deletions
+1 -2
View File
@@ -112,10 +112,9 @@ void timer_thread(RDRAM_ARG1) {
// Determine how long to wait to reach the timer's timestamp
auto wait_duration = ticks_to_timepoint(cur_timer->timestamp) - std::chrono::system_clock::now();
auto wait_us = std::chrono::duration_cast<std::chrono::microseconds>(wait_duration);
// Wait for either the duration to complete or a new action to come through
if (timer_context.action_queue.wait_dequeue_timed(cur_action, wait_duration)) {
if (wait_duration.count() >= 0 && timer_context.action_queue.wait_dequeue_timed(cur_action, wait_duration)) {
// Timer was interrupted by a new action
// Add the current timer back to the queue (done first in case the action is to remove this timer)
active_timers.insert(cur_timer_);