summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2022-03-12 12:06:57 +0100
committerbunnei <bunneidev@gmail.com>2022-03-15 02:14:54 +0100
commit5f3e77d93e93dded50b2fcf9f67291442197e567 (patch)
tree760e2cc11ac422fe1b330fd6d3649e77c7699f83
parentcore: hle: kernel: Downgrade dangling objects warning to debug. (diff)
downloadyuzu-5f3e77d93e93dded50b2fcf9f67291442197e567.tar
yuzu-5f3e77d93e93dded50b2fcf9f67291442197e567.tar.gz
yuzu-5f3e77d93e93dded50b2fcf9f67291442197e567.tar.bz2
yuzu-5f3e77d93e93dded50b2fcf9f67291442197e567.tar.lz
yuzu-5f3e77d93e93dded50b2fcf9f67291442197e567.tar.xz
yuzu-5f3e77d93e93dded50b2fcf9f67291442197e567.tar.zst
yuzu-5f3e77d93e93dded50b2fcf9f67291442197e567.zip
-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 {
// Gets the dummy KThread for the caller, allocating a new one if this is the first time
KThread* GetHostDummyThread() {
- auto make_thread = [this]() {
- KThread* thread = KThread::Create(system.Kernel());
+ auto initialize = [this](KThread* thread) {
ASSERT(KThread::InitializeDummyThread(thread).IsSuccess());
thread->SetName(fmt::format("DummyThread:{}", GetHostThreadId()));
return thread;
};
- thread_local KThread* saved_thread = make_thread();
- return saved_thread;
+ thread_local auto raw_thread = KThread(system.Kernel());
+ thread_local auto thread = initialize(&raw_thread);
+
+ return thread;
}
/// 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
return;
}
+ // Allocate a dummy guest thread for this host thread.
kernel.RegisterHostThread();
- // Ensure the dummy thread allocated for this host thread is closed on exit.
- auto* dummy_thread = kernel.GetCurrentEmuThread();
- SCOPE_EXIT({ dummy_thread->Close(); });
-
while (true) {
std::function<void()> task;