1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:17:42 +00:00

Kernel: Add simplistic work queues

We can't use deferred functions for anything that may require preemption,
such as copying from/to user or accessing the disk. For those purposes
we should use a work queue, which is essentially a kernel thread that
may be preempted or blocked.
This commit is contained in:
Tom 2021-02-05 23:36:38 -07:00 committed by Andreas Kling
parent 314f04b896
commit 20cccda731
7 changed files with 182 additions and 1 deletions

View file

@ -35,6 +35,7 @@
#include <Kernel/Storage/IDEController.h>
#include <Kernel/Storage/PATADiskDevice.h>
#include <Kernel/VM/MemoryManager.h>
#include <Kernel/WorkQueue.h>
namespace Kernel {
@ -122,7 +123,7 @@ void IDEChannel::complete_current_request(AsyncDeviceRequest::RequestResult resu
// This is important so that we can safely write the buffer back,
// which could cause page faults. Note that this may be called immediately
// before Processor::deferred_call_queue returns!
Processor::deferred_call_queue([this, result]() {
g_io_work->queue([this, result]() {
dbgln_if(PATA_DEBUG, "IDEChannel::complete_current_request result: {}", (int)result);
ScopedSpinLock lock(m_request_lock);
VERIFY(m_current_request);