Skip to content

Commit e851a77

Browse files
committed
Kernel: Rename FileBlocker::unblock() => unblock_if_conditions_are_met()
Since this may not actually unblock, the old name was very confusing.
1 parent 68a6d4c commit e851a77

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

Kernel/FileSystem/File.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class FileBlockerSet final : public Thread::BlockerSet {
2929
{
3030
VERIFY(b.blocker_type() == Thread::Blocker::Type::File);
3131
auto& blocker = static_cast<Thread::FileBlocker&>(b);
32-
return !blocker.unblock(true, data);
32+
return !blocker.unblock_if_conditions_are_met(true, data);
3333
}
3434

3535
void unblock_all_blockers_whose_conditions_are_met()
@@ -38,7 +38,7 @@ class FileBlockerSet final : public Thread::BlockerSet {
3838
BlockerSet::unblock_all_blockers_whose_conditions_are_met_locked([&](auto& b, void* data, bool&) {
3939
VERIFY(b.blocker_type() == Thread::Blocker::Type::File);
4040
auto& blocker = static_cast<Thread::FileBlocker&>(b);
41-
return blocker.unblock(false, data);
41+
return blocker.unblock_if_conditions_are_met(false, data);
4242
});
4343
}
4444
};

Kernel/Thread.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -602,14 +602,14 @@ class Thread
602602

603603
virtual Type blocker_type() const override { return Type::File; }
604604

605-
virtual bool unblock(bool, void*) = 0;
605+
virtual bool unblock_if_conditions_are_met(bool, void*) = 0;
606606
};
607607

608608
class FileDescriptionBlocker : public FileBlocker {
609609
public:
610610
const FileDescription& blocked_description() const;
611611

612-
virtual bool unblock(bool, void*) override;
612+
virtual bool unblock_if_conditions_are_met(bool, void*) override;
613613
virtual void will_unblock_immediately_without_blocking(UnblockImmediatelyReason) override;
614614
virtual bool setup_blocker() override;
615615

@@ -684,7 +684,7 @@ class Thread
684684
explicit SelectBlocker(FDVector&);
685685
virtual ~SelectBlocker();
686686

687-
virtual bool unblock(bool, void*) override;
687+
virtual bool unblock_if_conditions_are_met(bool, void*) override;
688688
virtual void will_unblock_immediately_without_blocking(UnblockImmediatelyReason) override;
689689
virtual void was_unblocked(bool) override;
690690
virtual StringView state_string() const override { return "Selecting"sv; }

Kernel/ThreadBlockers.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ bool Thread::FileDescriptionBlocker::setup_blocker()
208208
return add_to_blocker_set(m_blocked_description->blocker_set());
209209
}
210210

211-
bool Thread::FileDescriptionBlocker::unblock(bool from_add_blocker, void*)
211+
bool Thread::FileDescriptionBlocker::unblock_if_conditions_are_met(bool from_add_blocker, void*)
212212
{
213213
auto unblock_flags = m_blocked_description->should_unblock(m_flags);
214214
if (unblock_flags == BlockFlags::None)
@@ -238,13 +238,13 @@ void Thread::FileDescriptionBlocker::will_unblock_immediately_without_blocking(U
238238
// could be called by the BlockerSet at any time!
239239
VERIFY(reason == UnblockImmediatelyReason::TimeoutInThePast);
240240

241-
// Just call unblock here because we will query the file description
241+
// Just call unblock_if_conditions_are_met here because we will query the file description
242242
// for the data and don't need any input from the FileBlockerSet.
243243
// However, it's possible that if timeout_in_past is true then FileBlockerSet
244244
// may call us at any given time, so our call to unblock here may fail.
245245
// Either way, unblock will be called at least once, which provides
246246
// all the data we need.
247-
unblock(false, nullptr);
247+
unblock_if_conditions_are_met(false, nullptr);
248248
}
249249

250250
const FileDescription& Thread::FileDescriptionBlocker::blocked_description() const
@@ -386,7 +386,7 @@ void Thread::SelectBlocker::will_unblock_immediately_without_blocking(UnblockImm
386386
}
387387
}
388388

389-
bool Thread::SelectBlocker::unblock(bool from_add_blocker, void* data)
389+
bool Thread::SelectBlocker::unblock_if_conditions_are_met(bool from_add_blocker, void* data)
390390
{
391391
VERIFY(data); // data is a pointer to an entry in the m_fds vector
392392
auto& fd_info = *static_cast<FDInfo*>(data);

0 commit comments

Comments
 (0)