1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:48:12 +00:00

Kernel: Use a dedicated thread state for wait-queued threads

Instead of using the generic block mechanism, wait-queued threads now
go into the special Queued state.

This fixes an issue where signal dispatch would unblock a wait-queued
thread (because signal dispatch unblocks blocked threads) and cause
confusion since the thread only expected to be awoken by the queue.
This commit is contained in:
Andreas Kling 2019-12-01 15:54:47 +01:00
parent 7126a42d4d
commit 5859e16e53
5 changed files with 42 additions and 59 deletions

View file

@ -21,7 +21,7 @@ void WaitQueue::wake_one()
if (m_threads.is_empty())
return;
if (auto* thread = m_threads.take_first())
thread->unblock();
thread->wake_from_queue();
}
void WaitQueue::wake_all()
@ -30,5 +30,5 @@ void WaitQueue::wake_all()
if (m_threads.is_empty())
return;
while (!m_threads.is_empty())
m_threads.take_first()->unblock();
m_threads.take_first()->wake_from_queue();
}