From e851a77346e7ba168fa7094185f97f3b7fd53e70 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 5 Sep 2021 00:12:49 +0200 Subject: [PATCH] Kernel: Rename FileBlocker::unblock() => unblock_if_conditions_are_met() Since this may not actually unblock, the old name was very confusing. --- Kernel/FileSystem/File.h | 4 ++-- Kernel/Thread.h | 6 +++--- Kernel/ThreadBlockers.cpp | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Kernel/FileSystem/File.h b/Kernel/FileSystem/File.h index d0b0574a89..a47db9d9da 100644 --- a/Kernel/FileSystem/File.h +++ b/Kernel/FileSystem/File.h @@ -29,7 +29,7 @@ public: { VERIFY(b.blocker_type() == Thread::Blocker::Type::File); auto& blocker = static_cast(b); - return !blocker.unblock(true, data); + return !blocker.unblock_if_conditions_are_met(true, data); } void unblock_all_blockers_whose_conditions_are_met() @@ -38,7 +38,7 @@ public: BlockerSet::unblock_all_blockers_whose_conditions_are_met_locked([&](auto& b, void* data, bool&) { VERIFY(b.blocker_type() == Thread::Blocker::Type::File); auto& blocker = static_cast(b); - return blocker.unblock(false, data); + return blocker.unblock_if_conditions_are_met(false, data); }); } }; diff --git a/Kernel/Thread.h b/Kernel/Thread.h index 6b062ff980..b5e24cdeb9 100644 --- a/Kernel/Thread.h +++ b/Kernel/Thread.h @@ -602,14 +602,14 @@ public: virtual Type blocker_type() const override { return Type::File; } - virtual bool unblock(bool, void*) = 0; + virtual bool unblock_if_conditions_are_met(bool, void*) = 0; }; class FileDescriptionBlocker : public FileBlocker { public: const FileDescription& blocked_description() const; - virtual bool unblock(bool, void*) override; + virtual bool unblock_if_conditions_are_met(bool, void*) override; virtual void will_unblock_immediately_without_blocking(UnblockImmediatelyReason) override; virtual bool setup_blocker() override; @@ -684,7 +684,7 @@ public: explicit SelectBlocker(FDVector&); virtual ~SelectBlocker(); - virtual bool unblock(bool, void*) override; + virtual bool unblock_if_conditions_are_met(bool, void*) override; virtual void will_unblock_immediately_without_blocking(UnblockImmediatelyReason) override; virtual void was_unblocked(bool) override; virtual StringView state_string() const override { return "Selecting"sv; } diff --git a/Kernel/ThreadBlockers.cpp b/Kernel/ThreadBlockers.cpp index 2a2e2236c0..83b317f41f 100644 --- a/Kernel/ThreadBlockers.cpp +++ b/Kernel/ThreadBlockers.cpp @@ -208,7 +208,7 @@ bool Thread::FileDescriptionBlocker::setup_blocker() return add_to_blocker_set(m_blocked_description->blocker_set()); } -bool Thread::FileDescriptionBlocker::unblock(bool from_add_blocker, void*) +bool Thread::FileDescriptionBlocker::unblock_if_conditions_are_met(bool from_add_blocker, void*) { auto unblock_flags = m_blocked_description->should_unblock(m_flags); if (unblock_flags == BlockFlags::None) @@ -238,13 +238,13 @@ void Thread::FileDescriptionBlocker::will_unblock_immediately_without_blocking(U // could be called by the BlockerSet at any time! VERIFY(reason == UnblockImmediatelyReason::TimeoutInThePast); - // Just call unblock here because we will query the file description + // Just call unblock_if_conditions_are_met here because we will query the file description // for the data and don't need any input from the FileBlockerSet. // However, it's possible that if timeout_in_past is true then FileBlockerSet // may call us at any given time, so our call to unblock here may fail. // Either way, unblock will be called at least once, which provides // all the data we need. - unblock(false, nullptr); + unblock_if_conditions_are_met(false, nullptr); } const FileDescription& Thread::FileDescriptionBlocker::blocked_description() const @@ -386,7 +386,7 @@ void Thread::SelectBlocker::will_unblock_immediately_without_blocking(UnblockImm } } -bool Thread::SelectBlocker::unblock(bool from_add_blocker, void* data) +bool Thread::SelectBlocker::unblock_if_conditions_are_met(bool from_add_blocker, void* data) { VERIFY(data); // data is a pointer to an entry in the m_fds vector auto& fd_info = *static_cast(data);