sys_ppu: Implement sys_ppu_thread_rename

This commit is contained in:
Eladash 2021-07-18 13:01:06 +03:00 committed by Megamouse
parent e6e0210e73
commit 98e40d12ef
2 changed files with 10 additions and 2 deletions

View File

@ -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<std::string>(name));
g_tls_this_thread->set_name(std::move(name));
}
// Set thread name (not recommended)
template <typename T>
static void set_name(named_thread<T>& thread, std::string_view name)
static void set_name(named_thread<T>& thread, std::string name)
{
static_cast<thread_base&>(thread).m_tname.store(make_single<std::string>(name));
if (g_tls_this_thread == std::addressof(static_cast<thread_base&>(thread)))
{
g_tls_this_thread->set_name(std::move(name));
}
}
template <typename T>

View File

@ -545,6 +545,8 @@ error_code sys_ppu_thread_rename(ppu_thread& ppu, u32 thread_id, vm::cptr<char>
// 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;
}