summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/scheduler.cpp
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2020-05-13 14:17:34 -0400
committerGravatar Fernando Sahmkow2020-06-27 11:36:15 -0400
commitd24014358883987d7ebdafc4863a7bc36addfa1b (patch)
tree4277b9194972e40e124f130f2759268bf14cd4d6 /src/core/hle/kernel/scheduler.cpp
parentYuzuQT: Hide Speed UI on Multicore. (diff)
downloadyuzu-d24014358883987d7ebdafc4863a7bc36addfa1b.tar.gz
yuzu-d24014358883987d7ebdafc4863a7bc36addfa1b.tar.xz
yuzu-d24014358883987d7ebdafc4863a7bc36addfa1b.zip
Kernel: Correct Host Context on Threads and Scheduler.
Diffstat (limited to 'src/core/hle/kernel/scheduler.cpp')
-rw-r--r--src/core/hle/kernel/scheduler.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp
index 43c924fa0..61b8a396a 100644
--- a/src/core/hle/kernel/scheduler.cpp
+++ b/src/core/hle/kernel/scheduler.cpp
@@ -736,15 +736,15 @@ void Scheduler::SwitchContext() {
736 previous_thread->context_guard.unlock(); 736 previous_thread->context_guard.unlock();
737 } 737 }
738 738
739 std::shared_ptr<Common::Fiber> old_context; 739 std::shared_ptr<Common::Fiber>* old_context;
740 if (previous_thread != nullptr) { 740 if (previous_thread != nullptr) {
741 old_context = previous_thread->GetHostContext(); 741 old_context = &previous_thread->GetHostContext();
742 } else { 742 } else {
743 old_context = idle_thread->GetHostContext(); 743 old_context = &idle_thread->GetHostContext();
744 } 744 }
745 guard.unlock(); 745 guard.unlock();
746 746
747 Common::Fiber::YieldTo(old_context, switch_fiber); 747 Common::Fiber::YieldTo(*old_context, switch_fiber);
748 /// When a thread wakes up, the scheduler may have changed to other in another core. 748 /// When a thread wakes up, the scheduler may have changed to other in another core.
749 auto& next_scheduler = system.Kernel().CurrentScheduler(); 749 auto& next_scheduler = system.Kernel().CurrentScheduler();
750 next_scheduler.SwitchContextStep2(); 750 next_scheduler.SwitchContextStep2();
@@ -774,13 +774,13 @@ void Scheduler::SwitchToCurrent() {
774 break; 774 break;
775 } 775 }
776 } 776 }
777 std::shared_ptr<Common::Fiber> next_context; 777 std::shared_ptr<Common::Fiber>* next_context;
778 if (current_thread != nullptr) { 778 if (current_thread != nullptr) {
779 next_context = current_thread->GetHostContext(); 779 next_context = &current_thread->GetHostContext();
780 } else { 780 } else {
781 next_context = idle_thread->GetHostContext(); 781 next_context = &idle_thread->GetHostContext();
782 } 782 }
783 Common::Fiber::YieldTo(switch_fiber, next_context); 783 Common::Fiber::YieldTo(switch_fiber, *next_context);
784 } 784 }
785 } 785 }
786} 786}