1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 10:42:36 +01:00

Name some threads

This commit is contained in:
Megamouse 2024-01-27 20:33:54 +01:00
parent c3c73c7e24
commit cdfe3ee7c8
6 changed files with 25 additions and 7 deletions

View File

@ -130,6 +130,9 @@ public:
const native_entry entry_point;
// Set name for debugger
static void set_name(std::string);
private:
// Thread handle (platform-specific)
atomic_t<u64> m_thread{0};
@ -160,9 +163,6 @@ private:
// Cleanup after possibly deleting the thread instance
static native_entry finalize(u64 _self) noexcept;
// Set name for debugger
static void set_name(std::string);
// Make entry point
static native_entry make_trampoline(u64(*entry)(thread_base* _base));

View File

@ -764,6 +764,8 @@ namespace np
{
auto worker_function = [trans_ctx = trans_ctx, req_id, this](std::unique_lock<shared_mutex> lock)
{
thread_base::set_name("NP Trans Worker");
auto res = trans_ctx->wake_cond.wait_for(lock, std::chrono::microseconds(trans_ctx->timeout));
{
std::lock_guard lock_threads(this->mutex_async_transactions);

View File

@ -135,7 +135,8 @@ namespace rpcn
rpcn_client::rpcn_client()
: sem_connected(0), sem_authentified(0), sem_reader(0), sem_writer(0), sem_rpcn(0),
thread_rpcn(std::thread(&rpcn_client::rpcn_thread, this)), thread_rpcn_reader(std::thread(&rpcn_client::rpcn_reader_thread, this)),
thread_rpcn(std::thread(&rpcn_client::rpcn_thread, this)),
thread_rpcn_reader(std::thread(&rpcn_client::rpcn_reader_thread, this)),
thread_rpcn_writer(std::thread(&rpcn_client::rpcn_writer_thread, this))
{
g_cfg_rpcn.load();
@ -152,9 +153,12 @@ namespace rpcn
sem_reader.release();
sem_writer.release();
thread_rpcn.join();
thread_rpcn_reader.join();
thread_rpcn_writer.join();
if (thread_rpcn.joinable())
thread_rpcn.join();
if (thread_rpcn_reader.joinable())
thread_rpcn_reader.join();
if (thread_rpcn_writer.joinable())
thread_rpcn_writer.join();
disconnect();
@ -196,6 +200,8 @@ namespace rpcn
// RPCN thread
void rpcn_client::rpcn_reader_thread()
{
thread_base::set_name("RPCN Reader");
while (true)
{
sem_reader.acquire();
@ -219,6 +225,8 @@ namespace rpcn
void rpcn_client::rpcn_writer_thread()
{
thread_base::set_name("RPCN Writer");
while (true)
{
sem_writer.acquire();
@ -241,6 +249,8 @@ namespace rpcn
void rpcn_client::rpcn_thread()
{
thread_base::set_name("RPCN Client");
while (true)
{
sem_rpcn.acquire();

View File

@ -2494,6 +2494,8 @@ void Emulator::FinalizeRunRequest()
{
std::thread([this, info = GetEmulationIdentifier()]()
{
thread_base::set_name("Close Home Menu");
std::this_thread::sleep_for(2s);
CallFromMainThread([this]()

View File

@ -822,6 +822,8 @@ void gs_frame::take_screenshot(std::vector<u8> data, u32 sshot_width, u32 sshot_
std::thread(
[sshot_width, sshot_height, is_bgra](std::vector<u8> sshot_data)
{
thread_base::set_name("Screenshot");
screenshot_log.notice("Taking screenshot (%dx%d)", sshot_width, sshot_height);
const std::string& id = Emu.GetTitleID();

View File

@ -495,6 +495,8 @@ logs::file_writer::file_writer(const std::string& name, u64 max_size)
m_writer = std::thread([this]()
{
thread_base::set_name("Log Writer");
thread_ctrl::scoped_priority low_prio(-1);
while (true)