mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-26 04:32:35 +01:00
CPUThread.cpp: Fix an emulator crash on game exit
This commit is contained in:
parent
e29b81c444
commit
23c710cf53
@ -35,6 +35,7 @@ static thread_local u32 s_tls_thread_slot = -1;
|
||||
static thread_local u64 s_tls_sctr = -1;
|
||||
|
||||
extern thread_local void(*g_tls_log_control)(const char* fmt, u64 progress);
|
||||
extern thread_local std::string(*g_tls_log_prefix)();
|
||||
|
||||
template <>
|
||||
void fmt_class_string<cpu_flag>::format(std::string& out, u64 arg)
|
||||
@ -478,6 +479,8 @@ namespace cpu_counter
|
||||
|
||||
void cpu_thread::operator()()
|
||||
{
|
||||
const auto old_prefix = g_tls_log_prefix;
|
||||
|
||||
g_tls_this_thread = this;
|
||||
|
||||
if (g_cfg.core.thread_scheduler != thread_scheduler_mode::os)
|
||||
@ -545,6 +548,7 @@ void cpu_thread::operator()()
|
||||
{
|
||||
cpu_thread* _this = nullptr;
|
||||
std::string name;
|
||||
std::string(*log_prefix)() = nullptr;
|
||||
|
||||
void cleanup()
|
||||
{
|
||||
@ -571,6 +575,8 @@ void cpu_thread::operator()()
|
||||
|
||||
s_cpu_counter--;
|
||||
|
||||
g_tls_log_prefix = log_prefix;
|
||||
|
||||
g_tls_this_thread = nullptr;
|
||||
|
||||
g_threads_deleted++;
|
||||
@ -590,6 +596,7 @@ void cpu_thread::operator()()
|
||||
|
||||
cleanup._this = this;
|
||||
cleanup.name = thread_ctrl::get_name();
|
||||
cleanup.log_prefix = old_prefix;
|
||||
|
||||
// Check thread status
|
||||
while (!(state & cpu_flag::exit) && thread_ctrl::state() != thread_state::aborting)
|
||||
|
@ -602,7 +602,7 @@ void kernel_explorer::update()
|
||||
std::optional<std::scoped_lock<shared_mutex, shared_mutex>> lock_idm_lv2(std::in_place, id_manager::g_mutex, lv2_obj::g_mutex);
|
||||
|
||||
// Postponed as much as possible for time accuracy
|
||||
u64 current_time_storage = get_guest_system_time();
|
||||
u64 current_time_storage = 0;
|
||||
|
||||
auto get_current_time = [¤t_time_storage]()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user