diff --git a/libraries/libmesosphere/source/kern_k_scheduler.cpp b/libraries/libmesosphere/source/kern_k_scheduler.cpp index 320abdcd8..a4adf140b 100644 --- a/libraries/libmesosphere/source/kern_k_scheduler.cpp +++ b/libraries/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); } }