diff options
| author | 2020-02-11 17:36:39 -0400 | |
|---|---|---|
| committer | 2020-02-11 18:47:31 -0400 | |
| commit | d23d504d776007c1244a85ac1b7bb67c407067b2 (patch) | |
| tree | d6e992004bf752819084d648ca8b81fd1fc1db18 /src/core/hle/kernel/kernel.cpp | |
| parent | Kernel: Change WaitObject to Synchronization object. In order to better refle... (diff) | |
| download | yuzu-d23d504d776007c1244a85ac1b7bb67c407067b2.tar.gz yuzu-d23d504d776007c1244a85ac1b7bb67c407067b2.tar.xz yuzu-d23d504d776007c1244a85ac1b7bb67c407067b2.zip | |
Kernel: Refactor synchronization to better match RE
Diffstat (limited to 'src/core/hle/kernel/kernel.cpp')
| -rw-r--r-- | src/core/hle/kernel/kernel.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 26799f6b5..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" |
| @@ -96,7 +97,8 @@ static void ThreadWakeupCallback(u64 thread_handle, [[maybe_unused]] s64 cycles_ | |||
| 96 | } | 97 | } |
| 97 | 98 | ||
| 98 | struct KernelCore::Impl { | 99 | struct 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 | ||
| 276 | Kernel::Synchronization& KernelCore::Synchronization() { | ||
| 277 | return impl->synchronization; | ||
| 278 | } | ||
| 279 | |||
| 280 | const Kernel::Synchronization& KernelCore::Synchronization() const { | ||
| 281 | return impl->synchronization; | ||
| 282 | } | ||
| 283 | |||
| 273 | Core::ExclusiveMonitor& KernelCore::GetExclusiveMonitor() { | 284 | Core::ExclusiveMonitor& KernelCore::GetExclusiveMonitor() { |
| 274 | return *impl->exclusive_monitor; | 285 | return *impl->exclusive_monitor; |
| 275 | } | 286 | } |