summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/kernel.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2021-04-08 18:58:38 -0700
committerGravatar bunnei2021-05-05 16:40:50 -0700
commit722195cf704a628aa13c5a178a07dd33c186b952 (patch)
treeffa5a3c1f38605ce4daef982db6bbfa6bd7522fb /src/core/hle/kernel/kernel.cpp
parenthle: kernel: Migrate KEvent to KAutoObject. (diff)
downloadyuzu-722195cf704a628aa13c5a178a07dd33c186b952.tar.gz
yuzu-722195cf704a628aa13c5a178a07dd33c186b952.tar.xz
yuzu-722195cf704a628aa13c5a178a07dd33c186b952.zip
hle: kernel: Use unique_ptr for suspend and dummy threads.
Diffstat (limited to 'src/core/hle/kernel/kernel.cpp')
-rw-r--r--src/core/hle/kernel/kernel.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index cac76a6ec..1249a4c96 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -195,9 +195,9 @@ struct KernelCore::Impl {
195 195
196 void InitializeSuspendThreads() { 196 void InitializeSuspendThreads() {
197 for (s32 core_id = 0; core_id < Core::Hardware::NUM_CPU_CORES; core_id++) { 197 for (s32 core_id = 0; core_id < Core::Hardware::NUM_CPU_CORES; core_id++) {
198 suspend_threads[core_id] = KThread::CreateWithKernel(system.Kernel()); 198 suspend_threads[core_id] = std::make_unique<KThread>(system.Kernel());
199 ASSERT(KThread::InitializeHighPriorityThread(system, suspend_threads[core_id], {}, {}, 199 ASSERT(KThread::InitializeHighPriorityThread(system, suspend_threads[core_id].get(), {},
200 core_id) 200 {}, core_id)
201 .IsSuccess()); 201 .IsSuccess());
202 suspend_threads[core_id]->SetName(fmt::format("SuspendThread:{}", core_id)); 202 suspend_threads[core_id]->SetName(fmt::format("SuspendThread:{}", core_id));
203 } 203 }
@@ -235,14 +235,14 @@ struct KernelCore::Impl {
235 // Gets the dummy KThread for the caller, allocating a new one if this is the first time 235 // Gets the dummy KThread for the caller, allocating a new one if this is the first time
236 KThread* GetHostDummyThread() { 236 KThread* GetHostDummyThread() {
237 auto make_thread = [this]() { 237 auto make_thread = [this]() {
238 KThread* thread = KThread::CreateWithKernel(system.Kernel()); 238 std::unique_ptr<KThread> thread = std::make_unique<KThread>(system.Kernel());
239 ASSERT(KThread::InitializeDummyThread(thread).IsSuccess()); 239 ASSERT(KThread::InitializeDummyThread(thread.get()).IsSuccess());
240 thread->SetName(fmt::format("DummyThread:{}", GetHostThreadId())); 240 thread->SetName(fmt::format("DummyThread:{}", GetHostThreadId()));
241 return thread; 241 return std::move(thread);
242 }; 242 };
243 243
244 thread_local auto thread = make_thread(); 244 thread_local auto thread = make_thread();
245 return thread; 245 return thread.get();
246 } 246 }
247 247
248 /// Registers a CPU core thread by allocating a host thread ID for it 248 /// Registers a CPU core thread by allocating a host thread ID for it
@@ -661,7 +661,7 @@ struct KernelCore::Impl {
661 // the release of itself 661 // the release of itself
662 std::unique_ptr<Common::ThreadWorker> service_thread_manager; 662 std::unique_ptr<Common::ThreadWorker> service_thread_manager;
663 663
664 std::array<KThread*, Core::Hardware::NUM_CPU_CORES> suspend_threads{}; 664 std::array<std::unique_ptr<KThread>, Core::Hardware::NUM_CPU_CORES> suspend_threads;
665 std::array<Core::CPUInterruptHandler, Core::Hardware::NUM_CPU_CORES> interrupts{}; 665 std::array<Core::CPUInterruptHandler, Core::Hardware::NUM_CPU_CORES> interrupts{};
666 std::array<std::unique_ptr<Kernel::KScheduler>, Core::Hardware::NUM_CPU_CORES> schedulers{}; 666 std::array<std::unique_ptr<Kernel::KScheduler>, Core::Hardware::NUM_CPU_CORES> schedulers{};
667 667