Kernel: Rename Blocker::not_blocking(bool) to something more descriptive

Namely, will_unblock_immediately_without_blocking(Reason).

This virtual function is called on a blocker *before any block occurs*,
if it turns out that we don't need to block the thread after all.

This can happens for one of two reasons:

- UnblockImmediatelyReason::UnblockConditionAlreadyMet

    We don't need to block the thread because the condition for
    unblocking it is already met.

- UnblockImmediatelyReason::TimeoutInThePast

    We don't need to block the thread because a timeout was specified
    and that timeout is already in the past.

This patch does not introduce any behavior changes, it's only meant to
clarify this part of the blocking logic.
This commit is contained in:
Andreas Kling 2021-08-23 02:09:08 +02:00
parent 39474830a9
commit 7006cb82bd
Notes: sideshowbarker 2024-07-18 05:21:13 +09:00
5 changed files with 35 additions and 30 deletions

View file

@ -26,7 +26,7 @@ public:
virtual Type blocker_type() const override { return Type::Routing; }
virtual bool should_block() override { return m_should_block; }
virtual void not_blocking(bool) override;
virtual void will_unblock_immediately_without_blocking(UnblockImmediatelyReason) override;
bool unblock(bool from_add_blocker, const IPv4Address& ip_addr, const MACAddress& addr)
{
@ -90,9 +90,9 @@ ARPTableBlocker::ARPTableBlocker(IPv4Address ip_addr, Optional<MACAddress>& addr
m_should_block = false;
}
void ARPTableBlocker::not_blocking(bool timeout_in_past)
void ARPTableBlocker::will_unblock_immediately_without_blocking(UnblockImmediatelyReason reason)
{
VERIFY(timeout_in_past || !m_should_block);
VERIFY(reason == UnblockImmediatelyReason::TimeoutInThePast || !m_should_block);
auto addr = arp_table().with_shared([&](const auto& table) -> auto {
return table.get(ip_addr());
});