diff options
Diffstat (limited to 'src/core/hle/kernel/scheduler.cpp')
| -rw-r--r-- | src/core/hle/kernel/scheduler.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp index a4b234424..5cbd3b912 100644 --- a/src/core/hle/kernel/scheduler.cpp +++ b/src/core/hle/kernel/scheduler.cpp | |||
| @@ -756,7 +756,11 @@ void Scheduler::SwitchToCurrent() { | |||
| 756 | current_thread = selected_thread; | 756 | current_thread = selected_thread; |
| 757 | is_context_switch_pending = false; | 757 | is_context_switch_pending = false; |
| 758 | } | 758 | } |
| 759 | while (!is_context_switch_pending) { | 759 | const auto is_switch_pending = [this] { |
| 760 | std::scoped_lock lock{guard}; | ||
| 761 | return is_context_switch_pending; | ||
| 762 | }; | ||
| 763 | do { | ||
| 760 | if (current_thread != nullptr && !current_thread->IsHLEThread()) { | 764 | if (current_thread != nullptr && !current_thread->IsHLEThread()) { |
| 761 | current_thread->context_guard.lock(); | 765 | current_thread->context_guard.lock(); |
| 762 | if (!current_thread->IsRunnable()) { | 766 | if (!current_thread->IsRunnable()) { |
| @@ -775,7 +779,7 @@ void Scheduler::SwitchToCurrent() { | |||
| 775 | next_context = &idle_thread->GetHostContext(); | 779 | next_context = &idle_thread->GetHostContext(); |
| 776 | } | 780 | } |
| 777 | Common::Fiber::YieldTo(switch_fiber, *next_context); | 781 | Common::Fiber::YieldTo(switch_fiber, *next_context); |
| 778 | } | 782 | } while (!is_switch_pending()); |
| 779 | } | 783 | } |
| 780 | } | 784 | } |
| 781 | 785 | ||