Allow the scheduler to unblock the current process.

It's a bit confusing that the "current" process is not actually running
while we're inside the scheduler. Perhaps the scheduler should redirect
"current" to its own dummy Process. I'm not sure.

Regardless, this patch improves responsiveness by allowing the scheduler
to unblock a process right after it calls select() in case it already has
a pending wakeup request.
This commit is contained in:
Andreas Kling 2019-01-16 17:47:18 +01:00
commit a2ec09bc20
Notes: sideshowbarker 2024-07-19 16:01:25 +09:00
4 changed files with 16 additions and 4 deletions

View file

@ -1551,7 +1551,8 @@ pid_t Process::sys$waitpid(pid_t waitee, int* wstatus, int options)
void Process::unblock()
{
if (current == this) {
kprintf("ignoring unblock() on current, %s(%u) {%s}\n", name().characters(), pid(), toString(state()));
system.nblocked--;
m_state = Process::Running;
return;
}
ASSERT(m_state != Process::Runnable && m_state != Process::Running);