(Threaded Tasks) Fix race condition at task_queue_wait (#13898)

This commit is contained in:
Cthulhu-throwaway 2022-04-29 09:29:07 -03:00 committed by GitHub
parent 984f857621
commit 7a70b36c8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -423,6 +423,13 @@ static void retro_task_threaded_wait(retro_task_condition_fn_t cond, void* data)
slock_lock(running_lock);
wait = (tasks_running.front && !tasks_running.front->when);
slock_unlock(running_lock);
if (!wait)
{
slock_lock(finished_lock);
wait = (tasks_finished.front && !tasks_finished.front->when);
slock_unlock(finished_lock);
}
} while (wait && (!cond || cond(data)));
}