From 98e40d12ef4de1790210c3a276d33589f6700963 Mon Sep 17 00:00:00 2001 From: Eladash Date: Sun, 18 Jul 2021 13:01:06 +0300 Subject: [PATCH] sys_ppu: Implement sys_ppu_thread_rename --- Utilities/Thread.h | 10 ++++++++-- rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Utilities/Thread.h b/Utilities/Thread.h index 29d80ab4b6..bd6cbf548e 100644 --- a/Utilities/Thread.h +++ b/Utilities/Thread.h @@ -224,16 +224,22 @@ public: } // Set current thread name (not recommended) - static void set_name(std::string_view name) + static void set_name(std::string name) { g_tls_this_thread->m_tname.store(make_single(name)); + g_tls_this_thread->set_name(std::move(name)); } // Set thread name (not recommended) template - static void set_name(named_thread& thread, std::string_view name) + static void set_name(named_thread& thread, std::string name) { static_cast(thread).m_tname.store(make_single(name)); + + if (g_tls_this_thread == std::addressof(static_cast(thread))) + { + g_tls_this_thread->set_name(std::move(name)); + } } template diff --git a/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp b/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp index bec139a528..db6ecc80dc 100644 --- a/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp @@ -545,6 +545,8 @@ error_code sys_ppu_thread_rename(ppu_thread& ppu, u32 thread_id, vm::cptr // thread_ctrl name is not changed (TODO) sys_ppu_thread.warning(u8"sys_ppu_thread_rename(): Thread renamed to ā€œ%sā€", *_name); thread->ppu_tname.store(std::move(_name)); + thread_ctrl::set_name(*thread, thread->thread_name); // TODO: Currently sets debugger thread name only for local thread + return CELL_OK; }