mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 19:04:58 +00:00
Kernel: Dequeue dying threads from WaitQueue
If a thread is waiting but getting killed, we need to dequeue the thread from the WaitQueue so that a potential wake before finalization doesn't happen.
This commit is contained in:
@@ -56,6 +56,16 @@ bool WaitQueue::enqueue(Thread& thread)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WaitQueue::dequeue(Thread& thread)
|
||||
{
|
||||
ScopedSpinLock queue_lock(m_lock);
|
||||
if (m_threads.contains(thread)) {
|
||||
m_threads.remove(thread);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void WaitQueue::wake_one(Atomic<bool>* lock)
|
||||
{
|
||||
ScopedSpinLock queue_lock(m_lock);
|
||||
|
||||
Reference in New Issue
Block a user