mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 07:21:25 +12:00
Add g_fxo->init_crtp to simplify thread construction
This commit is contained in:
parent
7eebe06931
commit
fa02a04baa
3 changed files with 14 additions and 11 deletions
|
@ -498,7 +498,7 @@ namespace rsx
|
||||||
|
|
||||||
vblank_count = 0;
|
vblank_count = 0;
|
||||||
|
|
||||||
auto vblank_body = [this]()
|
g_fxo->init_crtp<named_thread>("VBlank Thread", [this]()
|
||||||
{
|
{
|
||||||
// See sys_timer_usleep for details
|
// See sys_timer_usleep for details
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
@ -562,11 +562,9 @@ namespace rsx
|
||||||
|
|
||||||
thread_ctrl::wait_for(100);
|
thread_ctrl::wait_for(100);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
g_fxo->init<named_thread<decltype(vblank_body)>>("VBlank Thread", std::move(vblank_body));
|
g_fxo->init_crtp<named_thread>("RSX Decompiler Thread", [this]
|
||||||
|
|
||||||
auto decomp_body = [this]
|
|
||||||
{
|
{
|
||||||
if (g_cfg.video.disable_asynchronous_shader_compiler)
|
if (g_cfg.video.disable_asynchronous_shader_compiler)
|
||||||
{
|
{
|
||||||
|
@ -597,9 +595,7 @@ namespace rsx
|
||||||
}
|
}
|
||||||
|
|
||||||
on_decompiler_exit();
|
on_decompiler_exit();
|
||||||
};
|
});
|
||||||
|
|
||||||
g_fxo->init<named_thread<decltype(decomp_body)>>("RSX Decompiler Thread", std::move(decomp_body));
|
|
||||||
|
|
||||||
// Raise priority above other threads
|
// Raise priority above other threads
|
||||||
thread_ctrl::set_native_priority(1);
|
thread_ctrl::set_native_priority(1);
|
||||||
|
|
|
@ -868,7 +868,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
|
||||||
// Workaround for analyser glitches
|
// Workaround for analyser glitches
|
||||||
vm::falloc(0x10000, 0xf0000, vm::main);
|
vm::falloc(0x10000, 0xf0000, vm::main);
|
||||||
|
|
||||||
auto sprx_loader_body = [this]
|
g_fxo->init_crtp<named_thread>("SPRX Loader"sv, [this]
|
||||||
{
|
{
|
||||||
std::vector<std::string> dir_queue;
|
std::vector<std::string> dir_queue;
|
||||||
dir_queue.emplace_back(m_path + '/');
|
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();
|
Emu.Stop();
|
||||||
});
|
});
|
||||||
};
|
});
|
||||||
|
|
||||||
g_fxo->init<named_thread<decltype(sprx_loader_body)>>("SPRX Loader"sv, std::move(sprx_loader_body));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,6 +165,14 @@ namespace stx
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Special stuff
|
||||||
|
template <template <class...> typename CTAD, typename... Args>
|
||||||
|
auto init_crtp(Args&&... args) noexcept
|
||||||
|
{
|
||||||
|
using T = decltype(CTAD{std::forward<Args>(args)...});
|
||||||
|
return init<T>(std::forward<Args>(args)...);
|
||||||
|
}
|
||||||
|
|
||||||
// Obtain object pointer (the only thread safe function)
|
// Obtain object pointer (the only thread safe function)
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T* get() const noexcept
|
T* get() const noexcept
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue