From e1e2be41d6b21f271668a615c3f91caa9962b8dd Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Thu, 13 Aug 2020 13:30:47 -0700 Subject: [PATCH] kern: fix bug in KScheduler::ClearPreviousThread --- libmesosphere/source/kern_k_scheduler.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libmesosphere/source/kern_k_scheduler.cpp b/libmesosphere/source/kern_k_scheduler.cpp index 320abdcd..a4adf140 100644 --- a/libmesosphere/source/kern_k_scheduler.cpp +++ b/libmesosphere/source/kern_k_scheduler.cpp @@ -281,7 +281,8 @@ namespace ams::kern { static_assert(std::atomic_ref::is_always_lock_free); /* Atomically clear the previous thread if it's our target. */ - prev_thread.compare_exchange_weak(thread, nullptr); + KThread *compare = thread; + prev_thread.compare_exchange_weak(compare, nullptr); } }