Merge pull request #8763 from JosJuice/panic-alert-deadlock-gpu

DolphinQt: Fix the panic alert deadlock, dual core edition
This commit is contained in:
Admiral H. Curtiss
2022-05-16 02:21:14 +02:00
committed by GitHub
5 changed files with 83 additions and 25 deletions

View File

@ -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;