summaryrefslogtreecommitdiff
path: root/src/core/core.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2018-10-10 00:42:10 -0400
committerGravatar Lioncash2018-10-10 02:04:55 -0400
commit5c0408596f6ccf5d2b171321bac386713b169d5b (patch)
tree1c5d3e1b178d7252cd3e752d8f2a99017a0ecb6d /src/core/core.cpp
parentMerge pull request #1461 from lioncash/warn (diff)
downloadyuzu-5c0408596f6ccf5d2b171321bac386713b169d5b.tar.gz
yuzu-5c0408596f6ccf5d2b171321bac386713b169d5b.tar.xz
yuzu-5c0408596f6ccf5d2b171321bac386713b169d5b.zip
kernel/thread: Use a regular pointer for the owner/current process
There's no real need to use a shared pointer in these cases, and only makes object management more fragile in terms of how easy it would be to introduce cycles. Instead, just do the simple thing of using a regular pointer. Much of this is just a hold-over from citra anyways. It also doesn't make sense from a behavioral point of view for a process' thread to prolong the lifetime of the process itself (the process is supposed to own the thread, not the other way around).
Diffstat (limited to 'src/core/core.cpp')
-rw-r--r--src/core/core.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index b6acfb3e4..e2fb9e038 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -136,7 +136,8 @@ struct System::Impl {
136 if (virtual_filesystem == nullptr) 136 if (virtual_filesystem == nullptr)
137 virtual_filesystem = std::make_shared<FileSys::RealVfsFilesystem>(); 137 virtual_filesystem = std::make_shared<FileSys::RealVfsFilesystem>();
138 138
139 kernel.MakeCurrentProcess(Kernel::Process::Create(kernel, "main")); 139 auto main_process = Kernel::Process::Create(kernel, "main");
140 kernel.MakeCurrentProcess(main_process.get());
140 141
141 cpu_barrier = std::make_shared<CpuBarrier>(); 142 cpu_barrier = std::make_shared<CpuBarrier>();
142 cpu_exclusive_monitor = Cpu::MakeExclusiveMonitor(cpu_cores.size()); 143 cpu_exclusive_monitor = Cpu::MakeExclusiveMonitor(cpu_cores.size());
@@ -361,11 +362,11 @@ const std::shared_ptr<Kernel::Scheduler>& System::Scheduler(std::size_t core_ind
361 return impl->cpu_cores[core_index]->Scheduler(); 362 return impl->cpu_cores[core_index]->Scheduler();
362} 363}
363 364
364Kernel::SharedPtr<Kernel::Process>& System::CurrentProcess() { 365Kernel::Process* System::CurrentProcess() {
365 return impl->kernel.CurrentProcess(); 366 return impl->kernel.CurrentProcess();
366} 367}
367 368
368const Kernel::SharedPtr<Kernel::Process>& System::CurrentProcess() const { 369const Kernel::Process* System::CurrentProcess() const {
369 return impl->kernel.CurrentProcess(); 370 return impl->kernel.CurrentProcess();
370} 371}
371 372