Improve thread aborting mechanism (#10490)

Call pseudo-virtual operator=(thread_state) of thread context.
This commit is contained in:
Eladash 2021-06-27 11:43:48 +03:00 committed by GitHub
parent 58847fa2ca
commit 0aed00a758
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 44 deletions

View file

@ -1534,14 +1534,6 @@ void Emulator::Stop(bool restart)
}
});
if (auto rsx = g_fxo->try_get<rsx::thread>())
{
// TODO: notify?
rsx->state += cpu_flag::exit;
}
cpu_thread::stop_all();
// Signal threads
for (const auto& [type, data] : *g_fxo)
{
@ -1551,6 +1543,11 @@ void Emulator::Stop(bool restart)
}
}
sys_log.notice("All emulation threads have been signaled.");
// Wait fot newly created cpu_thread to see that emulation has been stopped
id_manager::g_mutex.lock_unlock();
GetCallbacks().on_stop();
// Join threads