Browse Source
Merge pull request #8559 from liamwhite/waiter-list
kernel: fix usage of waiter_list in Finalize
pull/15/merge
bunnei
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
9 additions and
3 deletions
-
src/core/hle/kernel/k_thread.cpp
|
|
|
@ -308,14 +308,20 @@ void KThread::Finalize() { |
|
|
|
|
|
|
|
auto it = waiter_list.begin(); |
|
|
|
while (it != waiter_list.end()) { |
|
|
|
// Clear the lock owner
|
|
|
|
it->SetLockOwner(nullptr); |
|
|
|
// Get the thread.
|
|
|
|
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.
|
|
|
|
it = waiter_list.erase(it); |
|
|
|
|
|
|
|
// Cancel the thread's wait.
|
|
|
|
it->CancelWait(ResultInvalidState, true); |
|
|
|
waiter->CancelWait(ResultInvalidState, true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|