From fa02a04baaf8846a4c3d6b52510ec83f06b5978d Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Tue, 25 Feb 2020 11:51:41 +0300 Subject: [PATCH] Add g_fxo->init_crtp to simplify thread construction --- rpcs3/Emu/RSX/RSXThread.cpp | 12 ++++-------- rpcs3/Emu/System.cpp | 5 ++--- rpcs3/util/fixed_typemap.hpp | 8 ++++++++ 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index c9d6901a8c..a4700cbf1f 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -498,7 +498,7 @@ namespace rsx vblank_count = 0; - auto vblank_body = [this]() + g_fxo->init_crtp("VBlank Thread", [this]() { // See sys_timer_usleep for details #ifdef __linux__ @@ -562,11 +562,9 @@ namespace rsx thread_ctrl::wait_for(100); } - }; + }); - g_fxo->init>("VBlank Thread", std::move(vblank_body)); - - auto decomp_body = [this] + g_fxo->init_crtp("RSX Decompiler Thread", [this] { if (g_cfg.video.disable_asynchronous_shader_compiler) { @@ -597,9 +595,7 @@ namespace rsx } on_decompiler_exit(); - }; - - g_fxo->init>("RSX Decompiler Thread", std::move(decomp_body)); + }); // Raise priority above other threads thread_ctrl::set_native_priority(1); diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index d61225bd43..c4cbecf502 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -868,7 +868,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa // Workaround for analyser glitches vm::falloc(0x10000, 0xf0000, vm::main); - auto sprx_loader_body = [this] + g_fxo->init_crtp("SPRX Loader"sv, [this] { std::vector dir_queue; dir_queue.emplace_back(m_path + '/'); @@ -983,9 +983,8 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa { Emu.Stop(); }); - }; + }); - g_fxo->init>("SPRX Loader"sv, std::move(sprx_loader_body)); return; } diff --git a/rpcs3/util/fixed_typemap.hpp b/rpcs3/util/fixed_typemap.hpp index 7e468a4beb..d6a2da45ce 100644 --- a/rpcs3/util/fixed_typemap.hpp +++ b/rpcs3/util/fixed_typemap.hpp @@ -165,6 +165,14 @@ namespace stx return obj; } + // Special stuff + template