mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-12-26 11:22:33 -06:00
kernel: fix usage of waiter_list in Finalize
This commit is contained in:
parent
313f047f97
commit
1611c53c12
1 changed files with 9 additions and 3 deletions
|
@ -308,14 +308,20 @@ void KThread::Finalize() {
|
||||||
|
|
||||||
auto it = waiter_list.begin();
|
auto it = waiter_list.begin();
|
||||||
while (it != waiter_list.end()) {
|
while (it != waiter_list.end()) {
|
||||||
// Clear the lock owner
|
// Get the thread.
|
||||||
it->SetLockOwner(nullptr);
|
KThread* const waiter = std::addressof(*it);
|
||||||
|
|
||||||
|
// The thread shouldn't be a kernel waiter.
|
||||||
|
ASSERT(!IsKernelAddressKey(waiter->GetAddressKey()));
|
||||||
|
|
||||||
|
// Clear the lock owner.
|
||||||
|
waiter->SetLockOwner(nullptr);
|
||||||
|
|
||||||
// Erase the waiter from our list.
|
// Erase the waiter from our list.
|
||||||
it = waiter_list.erase(it);
|
it = waiter_list.erase(it);
|
||||||
|
|
||||||
// Cancel the thread's wait.
|
// Cancel the thread's wait.
|
||||||
it->CancelWait(ResultInvalidState, true);
|
waiter->CancelWait(ResultInvalidState, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue