diff options
| author | bunnei <bunneidev@gmail.com> | 2022-06-26 11:38:48 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-26 11:38:48 -0700 |
| commit | abfd690601eaa567b60c5eb844a688fe85e7dcea (patch) | |
| tree | bb7cc7e8746ffedb0f8ddf2ca82c19ae41f5c1be /src/core/hle/kernel/k_process.cpp | |
| parent | b321c3937137120f27a54ae01decf94f7fa781d1 (diff) | |
| parent | 2c56e94702e897c609711d82057d8267d8f4d0b3 (diff) | |
Merge pull request #8475 from liamwhite/x18
kernel: make current thread pointer thread local
Diffstat (limited to 'src/core/hle/kernel/k_process.cpp')
| -rw-r--r-- | src/core/hle/kernel/k_process.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp index cb84c20e3..b477c6e55 100644 --- a/src/core/hle/kernel/k_process.cpp +++ b/src/core/hle/kernel/k_process.cpp @@ -176,7 +176,8 @@ void KProcess::PinCurrentThread(s32 core_id) { ASSERT(kernel.GlobalSchedulerContext().IsLocked()); // Get the current thread. - KThread* cur_thread = kernel.Scheduler(static_cast<std::size_t>(core_id)).GetCurrentThread(); + KThread* cur_thread = + kernel.Scheduler(static_cast<std::size_t>(core_id)).GetSchedulerCurrentThread(); // If the thread isn't terminated, pin it. if (!cur_thread->IsTerminationRequested()) { @@ -193,7 +194,8 @@ void KProcess::UnpinCurrentThread(s32 core_id) { ASSERT(kernel.GlobalSchedulerContext().IsLocked()); // Get the current thread. - KThread* cur_thread = kernel.Scheduler(static_cast<std::size_t>(core_id)).GetCurrentThread(); + KThread* cur_thread = + kernel.Scheduler(static_cast<std::size_t>(core_id)).GetSchedulerCurrentThread(); // Unpin it. cur_thread->Unpin(); @@ -420,11 +422,11 @@ void KProcess::PrepareForTermination() { ChangeStatus(ProcessStatus::Exiting); const auto stop_threads = [this](const std::vector<KThread*>& in_thread_list) { - for (auto& thread : in_thread_list) { + for (auto* thread : in_thread_list) { if (thread->GetOwnerProcess() != this) continue; - if (thread == kernel.CurrentScheduler()->GetCurrentThread()) + if (thread == GetCurrentThreadPointer(kernel)) continue; // TODO(Subv): When are the other running/ready threads terminated? |
