mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
Kernel: Move Blocker setup out from constructors into setup_blocker()
Instead of registering with blocker sets and whatnot in the various Blocker subclass constructors, this patch moves such initialization to a separate setup_blocker() virtual. setup_blocker() returns false if there's no need to actually block the thread. This allows us to bail earlier in Thread::block().
This commit is contained in:
@@ -25,6 +25,7 @@ public:
|
||||
virtual StringView state_string() const override { return "Routing (ARP)"sv; }
|
||||
virtual Type blocker_type() const override { return Type::Routing; }
|
||||
virtual bool should_block() override { return m_should_block; }
|
||||
virtual bool setup_blocker() override;
|
||||
|
||||
virtual void will_unblock_immediately_without_blocking(UnblockImmediatelyReason) override;
|
||||
|
||||
@@ -85,9 +86,14 @@ static Singleton<ARPTableBlockerSet> s_arp_table_blocker_set;
|
||||
ARPTableBlocker::ARPTableBlocker(IPv4Address ip_addr, Optional<MACAddress>& addr)
|
||||
: m_ip_addr(ip_addr)
|
||||
, m_addr(addr)
|
||||
{
|
||||
}
|
||||
|
||||
bool ARPTableBlocker::setup_blocker()
|
||||
{
|
||||
if (!add_to_blocker_set(*s_arp_table_blocker_set))
|
||||
m_should_block = false;
|
||||
return m_should_block;
|
||||
}
|
||||
|
||||
void ARPTableBlocker::will_unblock_immediately_without_blocking(UnblockImmediatelyReason reason)
|
||||
|
||||
Reference in New Issue
Block a user