mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 02:41:49 -05:00
Merge pull request #12028 from liamwhite/coretiming-shutdown
core_timing: lock event queue access
This commit is contained in:
commit
9a5ef835cc
2 changed files with 3 additions and 1 deletions
|
@ -76,6 +76,7 @@ void CoreTiming::Initialize(std::function<void()>&& on_thread_init_) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreTiming::ClearPendingEvents() {
|
void CoreTiming::ClearPendingEvents() {
|
||||||
|
std::scoped_lock lock{basic_lock};
|
||||||
event_queue.clear();
|
event_queue.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,6 +114,7 @@ bool CoreTiming::IsRunning() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CoreTiming::HasPendingEvents() const {
|
bool CoreTiming::HasPendingEvents() const {
|
||||||
|
std::scoped_lock lock{basic_lock};
|
||||||
return !(wait_set && event_queue.empty());
|
return !(wait_set && event_queue.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ private:
|
||||||
std::shared_ptr<EventType> ev_lost;
|
std::shared_ptr<EventType> ev_lost;
|
||||||
Common::Event event{};
|
Common::Event event{};
|
||||||
Common::Event pause_event{};
|
Common::Event pause_event{};
|
||||||
std::mutex basic_lock;
|
mutable std::mutex basic_lock;
|
||||||
std::mutex advance_lock;
|
std::mutex advance_lock;
|
||||||
std::unique_ptr<std::jthread> timer_thread;
|
std::unique_ptr<std::jthread> timer_thread;
|
||||||
std::atomic<bool> paused{};
|
std::atomic<bool> paused{};
|
||||||
|
|
Loading…
Reference in a new issue