summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/kernel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel/kernel.cpp')
-rw-r--r--src/core/hle/kernel/kernel.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index edd4c4259..4eb1d8703 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -23,6 +23,7 @@
23#include "core/hle/kernel/process.h" 23#include "core/hle/kernel/process.h"
24#include "core/hle/kernel/resource_limit.h" 24#include "core/hle/kernel/resource_limit.h"
25#include "core/hle/kernel/scheduler.h" 25#include "core/hle/kernel/scheduler.h"
26#include "core/hle/kernel/synchronization.h"
26#include "core/hle/kernel/thread.h" 27#include "core/hle/kernel/thread.h"
27#include "core/hle/lock.h" 28#include "core/hle/lock.h"
28#include "core/hle/result.h" 29#include "core/hle/result.h"
@@ -54,10 +55,10 @@ static void ThreadWakeupCallback(u64 thread_handle, [[maybe_unused]] s64 cycles_
54 if (thread->GetStatus() == ThreadStatus::WaitSynch || 55 if (thread->GetStatus() == ThreadStatus::WaitSynch ||
55 thread->GetStatus() == ThreadStatus::WaitHLEEvent) { 56 thread->GetStatus() == ThreadStatus::WaitHLEEvent) {
56 // Remove the thread from each of its waiting objects' waitlists 57 // Remove the thread from each of its waiting objects' waitlists
57 for (const auto& object : thread->GetWaitObjects()) { 58 for (const auto& object : thread->GetSynchronizationObjects()) {
58 object->RemoveWaitingThread(thread); 59 object->RemoveWaitingThread(thread);
59 } 60 }
60 thread->ClearWaitObjects(); 61 thread->ClearSynchronizationObjects();
61 62
62 // Invoke the wakeup callback before clearing the wait objects 63 // Invoke the wakeup callback before clearing the wait objects
63 if (thread->HasWakeupCallback()) { 64 if (thread->HasWakeupCallback()) {
@@ -96,7 +97,8 @@ static void ThreadWakeupCallback(u64 thread_handle, [[maybe_unused]] s64 cycles_
96} 97}
97 98
98struct KernelCore::Impl { 99struct KernelCore::Impl {
99 explicit Impl(Core::System& system) : system{system}, global_scheduler{system} {} 100 explicit Impl(Core::System& system)
101 : system{system}, global_scheduler{system}, synchronization{system} {}
100 102
101 void Initialize(KernelCore& kernel) { 103 void Initialize(KernelCore& kernel) {
102 Shutdown(); 104 Shutdown();
@@ -191,6 +193,7 @@ struct KernelCore::Impl {
191 std::vector<std::shared_ptr<Process>> process_list; 193 std::vector<std::shared_ptr<Process>> process_list;
192 Process* current_process = nullptr; 194 Process* current_process = nullptr;
193 Kernel::GlobalScheduler global_scheduler; 195 Kernel::GlobalScheduler global_scheduler;
196 Kernel::Synchronization synchronization;
194 197
195 std::shared_ptr<ResourceLimit> system_resource_limit; 198 std::shared_ptr<ResourceLimit> system_resource_limit;
196 199
@@ -270,6 +273,14 @@ const Kernel::PhysicalCore& KernelCore::PhysicalCore(std::size_t id) const {
270 return impl->cores[id]; 273 return impl->cores[id];
271} 274}
272 275
276Kernel::Synchronization& KernelCore::Synchronization() {
277 return impl->synchronization;
278}
279
280const Kernel::Synchronization& KernelCore::Synchronization() const {
281 return impl->synchronization;
282}
283
273Core::ExclusiveMonitor& KernelCore::GetExclusiveMonitor() { 284Core::ExclusiveMonitor& KernelCore::GetExclusiveMonitor() {
274 return *impl->exclusive_monitor; 285 return *impl->exclusive_monitor;
275} 286}