Kernel: Break out of the idle loop on WaitQueue wake instead of on IRQ

Now that we have proper wait queues to drive waiter wakeup, we can use
the wake actions to break out of the scheduler's idle loop when we've
got a thread to run.
This commit is contained in:
Andreas Kling 2019-12-08 00:33:35 +01:00
parent 1f95ea1b6d
commit a0e38922bd
2 changed files with 3 additions and 4 deletions

View file

@ -3,7 +3,6 @@
#include "IRQHandler.h"
#include "PIC.h"
#include "Process.h"
#include "Scheduler.h"
#include <AK/Types.h>
#include <Kernel/Arch/i386/CPU.h>
#include <Kernel/KSyms.h>
@ -507,10 +506,8 @@ void handle_irq()
}
}
if (s_irq_handler[irq]) {
if (s_irq_handler[irq])
s_irq_handler[irq]->handle_irq();
Scheduler::stop_idling();
}
PIC::eoi(irq);
}

View file

@ -22,6 +22,7 @@ void WaitQueue::wake_one()
return;
if (auto* thread = m_threads.take_first())
thread->wake_from_queue();
Scheduler::stop_idling();
}
void WaitQueue::wake_all()
@ -31,4 +32,5 @@ void WaitQueue::wake_all()
return;
while (!m_threads.is_empty())
m_threads.take_first()->wake_from_queue();
Scheduler::stop_idling();
}