kern: fix bug in KScheduler::ClearPreviousThread

This commit is contained in:
Michael Scire 2020-08-13 13:30:47 -07:00
parent f75aa59f8c
commit 82ae603e0f

View file

@ -281,7 +281,8 @@ namespace ams::kern {
static_assert(std::atomic_ref<KThread *>::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);
}
}