summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-11-19 01:19:00 +0100
committerbunnei <bunneidev@gmail.com>2020-11-29 10:31:52 +0100
commitb7ef581c6e19d0159206aa42e1e03de461a77d7e (patch)
tree3a2fcbbbdc20c07d21290d187370f2cc9bd465b9 /src/core
parentcommon: fiber: Use VirtualBuffer for stack memory. (diff)
downloadyuzu-b7ef581c6e19d0159206aa42e1e03de461a77d7e.tar
yuzu-b7ef581c6e19d0159206aa42e1e03de461a77d7e.tar.gz
yuzu-b7ef581c6e19d0159206aa42e1e03de461a77d7e.tar.bz2
yuzu-b7ef581c6e19d0159206aa42e1e03de461a77d7e.tar.lz
yuzu-b7ef581c6e19d0159206aa42e1e03de461a77d7e.tar.xz
yuzu-b7ef581c6e19d0159206aa42e1e03de461a77d7e.tar.zst
yuzu-b7ef581c6e19d0159206aa42e1e03de461a77d7e.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/kernel/time_manager.cpp4
-rw-r--r--src/core/hle/kernel/time_manager.h2
2 files changed, 5 insertions, 1 deletions
diff --git a/src/core/hle/kernel/time_manager.cpp b/src/core/hle/kernel/time_manager.cpp
index ea9089ff8..caf329bfb 100644
--- a/src/core/hle/kernel/time_manager.cpp
+++ b/src/core/hle/kernel/time_manager.cpp
@@ -32,6 +32,7 @@ TimeManager::TimeManager(Core::System& system_) : system{system_} {
}
void TimeManager::ScheduleTimeEvent(Handle& event_handle, Thread* timetask, s64 nanoseconds) {
+ std::lock_guard lock{mutex};
event_handle = timetask->GetGlobalHandle();
if (nanoseconds > 0) {
ASSERT(timetask);
@@ -46,6 +47,7 @@ void TimeManager::ScheduleTimeEvent(Handle& event_handle, Thread* timetask, s64
}
void TimeManager::UnscheduleTimeEvent(Handle event_handle) {
+ std::lock_guard lock{mutex};
if (event_handle == InvalidHandle) {
return;
}
@@ -54,7 +56,7 @@ void TimeManager::UnscheduleTimeEvent(Handle event_handle) {
}
void TimeManager::CancelTimeEvent(Thread* time_task) {
- Handle event_handle = time_task->GetGlobalHandle();
+ const Handle event_handle = time_task->GetGlobalHandle();
UnscheduleTimeEvent(event_handle);
}
diff --git a/src/core/hle/kernel/time_manager.h b/src/core/hle/kernel/time_manager.h
index 307a18765..f39df39a0 100644
--- a/src/core/hle/kernel/time_manager.h
+++ b/src/core/hle/kernel/time_manager.h
@@ -5,6 +5,7 @@
#pragma once
#include <memory>
+#include <mutex>
#include <unordered_map>
#include "core/hle/kernel/object.h"
@@ -42,6 +43,7 @@ private:
Core::System& system;
std::shared_ptr<Core::Timing::EventType> time_manager_event_type;
std::unordered_map<Handle, bool> cancelled_events;
+ std::mutex mutex;
};
} // namespace Kernel