diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/core_timing.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index b45c1b918..a75bfea60 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp | |||
| @@ -143,13 +143,17 @@ void CoreTiming::ScheduleLoopingEvent(std::chrono::nanoseconds start_time, | |||
| 143 | std::chrono::nanoseconds resched_time, | 143 | std::chrono::nanoseconds resched_time, |
| 144 | const std::shared_ptr<EventType>& event_type, | 144 | const std::shared_ptr<EventType>& event_type, |
| 145 | std::uintptr_t user_data, bool absolute_time) { | 145 | std::uintptr_t user_data, bool absolute_time) { |
| 146 | std::scoped_lock scope{basic_lock}; | 146 | { |
| 147 | const auto next_time{absolute_time ? start_time : GetGlobalTimeNs() + start_time}; | 147 | std::scoped_lock scope{basic_lock}; |
| 148 | const auto next_time{absolute_time ? start_time : GetGlobalTimeNs() + start_time}; | ||
| 149 | |||
| 150 | event_queue.emplace_back( | ||
| 151 | Event{next_time.count(), event_fifo_id++, user_data, event_type, resched_time.count()}); | ||
| 148 | 152 | ||
| 149 | event_queue.emplace_back( | 153 | std::push_heap(event_queue.begin(), event_queue.end(), std::greater<>()); |
| 150 | Event{next_time.count(), event_fifo_id++, user_data, event_type, resched_time.count()}); | 154 | } |
| 151 | 155 | ||
| 152 | std::push_heap(event_queue.begin(), event_queue.end(), std::greater<>()); | 156 | event.Set(); |
| 153 | } | 157 | } |
| 154 | 158 | ||
| 155 | void CoreTiming::UnscheduleEvent(const std::shared_ptr<EventType>& event_type, | 159 | void CoreTiming::UnscheduleEvent(const std::shared_ptr<EventType>& event_type, |