mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:38:11 +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:
parent
7126a42d4d
commit
5859e16e53
5 changed files with 42 additions and 59 deletions
|
@ -82,18 +82,6 @@ bool Thread::JoinBlocker::should_unblock(Thread& joiner, time_t, long)
|
|||
return !joiner.m_joinee;
|
||||
}
|
||||
|
||||
Thread::WaitQueueBlocker::WaitQueueBlocker(WaitQueue& queue)
|
||||
: m_queue(queue)
|
||||
{
|
||||
m_queue.enqueue(*current);
|
||||
}
|
||||
|
||||
bool Thread::WaitQueueBlocker::should_unblock(Thread&, time_t, long)
|
||||
{
|
||||
// Someone else will have to unblock us by calling wake_one() or wake_all() on the queue.
|
||||
return false;
|
||||
}
|
||||
|
||||
Thread::FileDescriptionBlocker::FileDescriptionBlocker(const FileDescription& description)
|
||||
: m_blocked_description(description)
|
||||
{
|
||||
|
@ -268,6 +256,7 @@ void Thread::consider_unblock(time_t now_sec, long now_usec)
|
|||
case Thread::Running:
|
||||
case Thread::Dead:
|
||||
case Thread::Stopped:
|
||||
case Thread::Queued:
|
||||
/* don't know, don't care */
|
||||
return;
|
||||
case Thread::Blocked:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue