diff options
| author | liamwhite <liamwhite@users.noreply.github.com> | 2023-11-14 12:23:11 -0500 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-14 12:23:11 -0500 | 
| commit | 9a5ef835cc8cf3d9fb8fa791d03a43ae4472d614 (patch) | |
| tree | 79adeb345dc422ae213054bfc7bc0a91f1094c47 | |
| parent | df0d3698ae8f57f70a4502c79973a9ee88397f97 (diff) | |
| parent | ec6b67d862a2606d6e9fe1036746605a6bfe5114 (diff) | |
Merge pull request #12028 from liamwhite/coretiming-shutdown
core_timing: lock event queue access
| -rw-r--r-- | src/core/core_timing.cpp | 2 | ||||
| -rw-r--r-- | src/core/core_timing.h | 2 | 
2 files changed, 3 insertions, 1 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index e671b270f..d6b5abc68 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp @@ -76,6 +76,7 @@ void CoreTiming::Initialize(std::function<void()>&& on_thread_init_) {  }  void CoreTiming::ClearPendingEvents() { +    std::scoped_lock lock{basic_lock};      event_queue.clear();  } @@ -113,6 +114,7 @@ bool CoreTiming::IsRunning() const {  }  bool CoreTiming::HasPendingEvents() const { +    std::scoped_lock lock{basic_lock};      return !(wait_set && event_queue.empty());  } diff --git a/src/core/core_timing.h b/src/core/core_timing.h index 26a8b93a7..21548f0a9 100644 --- a/src/core/core_timing.h +++ b/src/core/core_timing.h @@ -161,7 +161,7 @@ private:      std::shared_ptr<EventType> ev_lost;      Common::Event event{};      Common::Event pause_event{}; -    std::mutex basic_lock; +    mutable std::mutex basic_lock;      std::mutex advance_lock;      std::unique_ptr<std::jthread> timer_thread;      std::atomic<bool> paused{};  | 
