summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-01-25 07:54:37 +0100
committerbunnei <bunneidev@gmail.com>2021-01-29 06:42:26 +0100
commit3856564727e3efcf85fb0c1e5431cab22d818370 (patch)
tree589d4322c34c6ae15184b322b9302c33f1c34087 /src/core/hle/kernel/svc.cpp
parenthle: kernel: threading: Fix bug with host thread naming. (diff)
downloadyuzu-3856564727e3efcf85fb0c1e5431cab22d818370.tar
yuzu-3856564727e3efcf85fb0c1e5431cab22d818370.tar.gz
yuzu-3856564727e3efcf85fb0c1e5431cab22d818370.tar.bz2
yuzu-3856564727e3efcf85fb0c1e5431cab22d818370.tar.lz
yuzu-3856564727e3efcf85fb0c1e5431cab22d818370.tar.xz
yuzu-3856564727e3efcf85fb0c1e5431cab22d818370.tar.zst
yuzu-3856564727e3efcf85fb0c1e5431cab22d818370.zip
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r--src/core/hle/kernel/svc.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index dbef854f8..7fd514e9d 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -1450,11 +1450,14 @@ static ResultCode CreateThread(Core::System& system, Handle* out_handle, VAddr e
Svc::ResultInvalidPriority);
R_UNLESS(process.CheckThreadPriority(priority), Svc::ResultInvalidPriority);
- ASSERT(kernel.CurrentProcess()->GetResourceLimit()->Reserve(ResourceType::Threads, 1));
+ ASSERT(process.GetResourceLimit()->Reserve(ResourceType::Threads, 1));
- CASCADE_RESULT(std::shared_ptr<KThread> thread,
- KThread::Create(system, ThreadType::User, "", entry_point, priority, arg,
- core_id, stack_bottom, &process));
+ std::shared_ptr<KThread> thread;
+ {
+ KScopedLightLock lk{process.GetStateLock()};
+ CASCADE_RESULT(thread, KThread::Create(system, ThreadType::User, "", entry_point, priority,
+ arg, core_id, stack_bottom, &process));
+ }
const auto new_thread_handle = process.GetHandleTable().Create(thread);
if (new_thread_handle.Failed()) {