mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
DolphinQt: Fix the panic alert deadlock, GPU thread edition
The fix in ef77872
worked for panic alerts from
the CPU thread, but there were still problems with
panic alerts from the GPU thread in dual core mode.
This change attempts to fix those.
This commit is contained in:
@ -127,6 +127,7 @@ static std::queue<HostJob> s_host_jobs_queue;
|
||||
static Common::Event s_cpu_thread_job_finished;
|
||||
|
||||
static thread_local bool tls_is_cpu_thread = false;
|
||||
static thread_local bool tls_is_gpu_thread = false;
|
||||
|
||||
static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi);
|
||||
|
||||
@ -203,14 +204,7 @@ bool IsCPUThread()
|
||||
|
||||
bool IsGPUThread()
|
||||
{
|
||||
if (Core::System::GetInstance().IsDualCoreMode())
|
||||
{
|
||||
return (s_emu_thread.joinable() && (s_emu_thread.get_id() == std::this_thread::get_id()));
|
||||
}
|
||||
else
|
||||
{
|
||||
return IsCPUThread();
|
||||
}
|
||||
return tls_is_gpu_thread;
|
||||
}
|
||||
|
||||
bool WantsDeterminism()
|
||||
@ -313,6 +307,16 @@ void UndeclareAsCPUThread()
|
||||
tls_is_cpu_thread = false;
|
||||
}
|
||||
|
||||
void DeclareAsGPUThread()
|
||||
{
|
||||
tls_is_gpu_thread = true;
|
||||
}
|
||||
|
||||
void UndeclareAsGPUThread()
|
||||
{
|
||||
tls_is_gpu_thread = false;
|
||||
}
|
||||
|
||||
// For the CPU Thread only.
|
||||
static void CPUSetInitialExecutionState(bool force_paused = false)
|
||||
{
|
||||
@ -459,6 +463,8 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
|
||||
|
||||
Common::SetCurrentThreadName("Emuthread - Starting");
|
||||
|
||||
DeclareAsGPUThread();
|
||||
|
||||
// For a time this acts as the CPU thread...
|
||||
DeclareAsCPUThread();
|
||||
s_frame_step = false;
|
||||
|
Reference in New Issue
Block a user