summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/kernel.cpp9
-rw-r--r--src/core/hle/kernel/service_thread.cpp5
2 files changed, 6 insertions, 8 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 16d3a6cb4..f9828bc43 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -283,15 +283,16 @@ struct KernelCore::Impl {
283 283
284 // Gets the dummy KThread for the caller, allocating a new one if this is the first time 284 // Gets the dummy KThread for the caller, allocating a new one if this is the first time
285 KThread* GetHostDummyThread() { 285 KThread* GetHostDummyThread() {
286 auto make_thread = [this]() { 286 auto initialize = [this](KThread* thread) {
287 KThread* thread = KThread::Create(system.Kernel());
288 ASSERT(KThread::InitializeDummyThread(thread).IsSuccess()); 287 ASSERT(KThread::InitializeDummyThread(thread).IsSuccess());
289 thread->SetName(fmt::format("DummyThread:{}", GetHostThreadId())); 288 thread->SetName(fmt::format("DummyThread:{}", GetHostThreadId()));
290 return thread; 289 return thread;
291 }; 290 };
292 291
293 thread_local KThread* saved_thread = make_thread(); 292 thread_local auto raw_thread = KThread(system.Kernel());
294 return saved_thread; 293 thread_local auto thread = initialize(&raw_thread);
294
295 return thread;
295 } 296 }
296 297
297 /// Registers a CPU core thread by allocating a host thread ID for it 298 /// Registers a CPU core thread by allocating a host thread ID for it
diff --git a/src/core/hle/kernel/service_thread.cpp b/src/core/hle/kernel/service_thread.cpp
index 4eb3a5988..52d25b837 100644
--- a/src/core/hle/kernel/service_thread.cpp
+++ b/src/core/hle/kernel/service_thread.cpp
@@ -49,12 +49,9 @@ ServiceThread::Impl::Impl(KernelCore& kernel, std::size_t num_threads, const std
49 return; 49 return;
50 } 50 }
51 51
52 // Allocate a dummy guest thread for this host thread.
52 kernel.RegisterHostThread(); 53 kernel.RegisterHostThread();
53 54
54 // Ensure the dummy thread allocated for this host thread is closed on exit.
55 auto* dummy_thread = kernel.GetCurrentEmuThread();
56 SCOPE_EXIT({ dummy_thread->Close(); });
57
58 while (true) { 55 while (true) {
59 std::function<void()> task; 56 std::function<void()> task;
60 57