summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2022-03-09 21:26:08 +0200
committerLinus Groh <mail@linusgroh.de>2022-04-20 19:47:18 +0200
commitbf16061142456473de66f1c3c85345ca8dd04377 (patch)
treed9d0a6f8a2f3e4e153108184fe0e5b21888a5c6c /Kernel
parent1462211ccf5b0d823bd0b518a7d7ac0e1d31ea1c (diff)
downloadserenity-bf16061142456473de66f1c3c85345ca8dd04377.zip
Kernel: Take WorkQueue item as reference instead of pointer in do_queue
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/WorkQueue.cpp4
-rw-r--r--Kernel/WorkQueue.h6
2 files changed, 5 insertions, 5 deletions
diff --git a/Kernel/WorkQueue.cpp b/Kernel/WorkQueue.cpp
index 2c820a9e78..71b3a2199f 100644
--- a/Kernel/WorkQueue.cpp
+++ b/Kernel/WorkQueue.cpp
@@ -47,10 +47,10 @@ UNMAP_AFTER_INIT WorkQueue::WorkQueue(StringView name)
m_thread = thread.release_nonnull();
}
-void WorkQueue::do_queue(WorkItem* item)
+void WorkQueue::do_queue(WorkItem& item)
{
m_items.with([&](auto& items) {
- items.append(*item);
+ items.append(item);
});
m_wait_queue.wake_one();
}
diff --git a/Kernel/WorkQueue.h b/Kernel/WorkQueue.h
index a2f1b88584..2ce1e35b02 100644
--- a/Kernel/WorkQueue.h
+++ b/Kernel/WorkQueue.h
@@ -34,7 +34,7 @@ public:
if (free_data)
free_data(data);
};
- do_queue(item);
+ do_queue(*item);
return {};
}
@@ -45,7 +45,7 @@ public:
if (!item)
return Error::from_errno(ENOMEM);
item->function = Function(function);
- do_queue(item);
+ do_queue(*item);
return {};
}
@@ -58,7 +58,7 @@ private:
Function<void()> function;
};
- void do_queue(WorkItem*);
+ void do_queue(WorkItem&);
RefPtr<Thread> m_thread;
WaitQueue m_wait_queue;