mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-17 08:34:23 -04:00
kern: mostly implement thread exit
This commit is contained in:
parent
c8f71007ec
commit
4a767c9082
8 changed files with 126 additions and 3 deletions
|
@ -262,6 +262,16 @@ namespace ams::kern {
|
|||
cpu::SwitchThreadLocalRegion(GetInteger(next_thread->GetThreadLocalRegionAddress()));
|
||||
}
|
||||
|
||||
void KScheduler::ClearPreviousThread(KThread *thread) {
|
||||
MESOSPHERE_ASSERT(IsSchedulerLockedByCurrentThread());
|
||||
for (size_t i = 0; i < cpu::NumCores; ++i) {
|
||||
std::atomic<KThread *> *prev_thread_ptr = reinterpret_cast<std::atomic<KThread *> *>(std::addressof(Kernel::GetScheduler(static_cast<s32>(i)).prev_thread));
|
||||
static_assert(sizeof(*prev_thread_ptr) == sizeof(KThread *));
|
||||
|
||||
prev_thread_ptr->compare_exchange_weak(thread, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void KScheduler::OnThreadStateChanged(KThread *thread, KThread::ThreadState old_state) {
|
||||
MESOSPHERE_ASSERT(IsSchedulerLockedByCurrentThread());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue