Scheduler: Fix HLE Threads on guard

This commit is contained in:
Fernando Sahmkow 2020-03-06 20:36:05 -04:00
parent 3de33348e4
commit 6ed28e15fa

View file

@ -689,11 +689,13 @@ void Scheduler::SwitchToCurrent() {
current_thread = selected_thread; current_thread = selected_thread;
guard.unlock(); guard.unlock();
while (!is_context_switch_pending) { while (!is_context_switch_pending) {
if (current_thread != nullptr) {
current_thread->context_guard.lock(); current_thread->context_guard.lock();
if (current_thread->GetSchedulingStatus() != ThreadSchedStatus::Runnable) { if (current_thread->GetSchedulingStatus() != ThreadSchedStatus::Runnable) {
current_thread->context_guard.unlock(); current_thread->context_guard.unlock();
break; break;
} }
}
std::shared_ptr<Common::Fiber> next_context; std::shared_ptr<Common::Fiber> next_context;
if (current_thread != nullptr) { if (current_thread != nullptr) {
next_context = current_thread->GetHostContext(); next_context = current_thread->GetHostContext();