From 40bc378d81ba9b378e505621291d5d5145a58bcc Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 23 Aug 2021 00:10:33 +0200 Subject: Kernel: Rename QueueBlocker => WaitQueueBlocker This is a Thread::Blocker that blocks on a WaitQueue, so let's call it a WaitQueueBlocker to improve clarity. :^) --- Kernel/Thread.h | 8 ++++---- Kernel/ThreadBlockers.cpp | 6 +++--- Kernel/WaitQueue.cpp | 6 +++--- Kernel/WaitQueue.h | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Kernel/Thread.h b/Kernel/Thread.h index 4a954c0308..e2bf985841 100644 --- a/Kernel/Thread.h +++ b/Kernel/Thread.h @@ -522,10 +522,10 @@ public: bool m_should_block { true }; }; - class QueueBlocker final : public Blocker { + class WaitQueueBlocker final : public Blocker { public: - explicit QueueBlocker(WaitQueue&, StringView block_reason = {}); - virtual ~QueueBlocker(); + explicit WaitQueueBlocker(WaitQueue&, StringView block_reason = {}); + virtual ~WaitQueueBlocker(); virtual Type blocker_type() const override { return Type::Queue; } virtual StringView state_string() const override { return m_block_reason.is_null() ? m_block_reason : "Queue"sv; } @@ -981,7 +981,7 @@ public: Thread::BlockResult wait_on(WaitQueue& wait_queue, const Thread::BlockTimeout& timeout, Args&&... args) { VERIFY(this == Thread::current()); - return block(timeout, wait_queue, forward(args)...); + return block(timeout, wait_queue, forward(args)...); } BlockResult sleep(clockid_t, const Time&, Time* = nullptr); diff --git a/Kernel/ThreadBlockers.cpp b/Kernel/ThreadBlockers.cpp index fd2ac4a06f..8768306011 100644 --- a/Kernel/ThreadBlockers.cpp +++ b/Kernel/ThreadBlockers.cpp @@ -118,18 +118,18 @@ bool Thread::JoinBlocker::unblock(void* value, bool from_add_blocker) return true; } -Thread::QueueBlocker::QueueBlocker(WaitQueue& wait_queue, StringView block_reason) +Thread::WaitQueueBlocker::WaitQueueBlocker(WaitQueue& wait_queue, StringView block_reason) : m_block_reason(block_reason) { if (!add_to_blocker_set(wait_queue, Thread::current())) m_should_block = false; } -Thread::QueueBlocker::~QueueBlocker() +Thread::WaitQueueBlocker::~WaitQueueBlocker() { } -bool Thread::QueueBlocker::unblock() +bool Thread::WaitQueueBlocker::unblock() { { SpinlockLocker lock(m_lock); diff --git a/Kernel/WaitQueue.cpp b/Kernel/WaitQueue.cpp index 65c74b3bdb..4a1d19a322 100644 --- a/Kernel/WaitQueue.cpp +++ b/Kernel/WaitQueue.cpp @@ -32,7 +32,7 @@ u32 WaitQueue::wake_one() bool did_unblock_one = unblock_all_blockers_whose_conditions_are_met_locked([&](Thread::Blocker& b, void* data, bool& stop_iterating) { VERIFY(data); VERIFY(b.blocker_type() == Thread::Blocker::Type::Queue); - auto& blocker = static_cast(b); + auto& blocker = static_cast(b); dbgln_if(WAITQUEUE_DEBUG, "WaitQueue @ {}: wake_one unblocking {}", this, data); if (blocker.unblock()) { stop_iterating = true; @@ -57,7 +57,7 @@ u32 WaitQueue::wake_n(u32 wake_count) bool did_unblock_some = unblock_all_blockers_whose_conditions_are_met_locked([&](Thread::Blocker& b, void* data, bool& stop_iterating) { VERIFY(data); VERIFY(b.blocker_type() == Thread::Blocker::Type::Queue); - auto& blocker = static_cast(b); + auto& blocker = static_cast(b); dbgln_if(WAITQUEUE_DEBUG, "WaitQueue @ {}: wake_n unblocking {}", this, data); VERIFY(did_wake < wake_count); if (blocker.unblock()) { @@ -82,7 +82,7 @@ u32 WaitQueue::wake_all() bool did_unblock_any = unblock_all_blockers_whose_conditions_are_met_locked([&](Thread::Blocker& b, void* data, bool&) { VERIFY(data); VERIFY(b.blocker_type() == Thread::Blocker::Type::Queue); - auto& blocker = static_cast(b); + auto& blocker = static_cast(b); dbgln_if(WAITQUEUE_DEBUG, "WaitQueue @ {}: wake_all unblocking {}", this, data); diff --git a/Kernel/WaitQueue.h b/Kernel/WaitQueue.h index b093feeea8..c3c99ac3dc 100644 --- a/Kernel/WaitQueue.h +++ b/Kernel/WaitQueue.h @@ -27,13 +27,13 @@ public: template Thread::BlockResult wait_on(const Thread::BlockTimeout& timeout, Args&&... args) { - return Thread::current()->block(timeout, *this, forward(args)...); + return Thread::current()->block(timeout, *this, forward(args)...); } template void wait_forever(Args&&... args) { - (void)Thread::current()->block({}, *this, forward(args)...); + (void)Thread::current()->block({}, *this, forward(args)...); } protected: -- cgit v1.2.3