From 717265a54c102030025a62521a3c34e0ce559885 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 --- libraries/libmesosphere/source/kern_k_scheduler.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); } }