mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-05 06:26:49 +00:00
Improve emulation stopping speed
Split phases of signalling threads and joining them.
This commit is contained in:
parent
2169e8d935
commit
76bf720adf
6 changed files with 109 additions and 39 deletions
|
|
@ -1543,6 +1543,35 @@ void Emulator::Stop(bool restart)
|
|||
}
|
||||
|
||||
cpu_thread::stop_all();
|
||||
|
||||
using fxo_t = std::remove_pointer_t<decltype(g_fxo)>;
|
||||
|
||||
// Signal threads
|
||||
for (const auto& type : fxo_t::view_typelist())
|
||||
{
|
||||
if (type.stop)
|
||||
{
|
||||
if (auto data = g_fxo->try_get(type))
|
||||
{
|
||||
type.stop(data, thread_state::aborting);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Join threads
|
||||
for (const auto& type : fxo_t::view_typelist())
|
||||
{
|
||||
if (type.stop)
|
||||
{
|
||||
if (auto data = g_fxo->try_get(type))
|
||||
{
|
||||
type.stop(data, thread_state::finished);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cpu_thread::cleanup();
|
||||
|
||||
g_fxo->reset();
|
||||
|
||||
sys_log.notice("All threads have been stopped.");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue