Kernel: Rename FileBlocker::unblock() => unblock_if_conditions_are_met()

Since this may not actually unblock, the old name was very confusing.
This commit is contained in:
Andreas Kling 2021-09-05 00:12:49 +02:00
parent 68a6d4c30a
commit e851a77346
Notes: sideshowbarker 2024-07-18 04:44:27 +09:00
3 changed files with 9 additions and 9 deletions

View File

@ -29,7 +29,7 @@ public:
{
VERIFY(b.blocker_type() == Thread::Blocker::Type::File);
auto& blocker = static_cast<Thread::FileBlocker&>(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<Thread::FileBlocker&>(b);
return blocker.unblock(false, data);
return blocker.unblock_if_conditions_are_met(false, data);
});
}
};

View File

@ -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; }

View File

@ -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<FDInfo*>(data);