mirror of
https://github.com/RGBCube/serenity
synced 2025-07-02 19:42:14 +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:
parent
c108c8ff24
commit
82c3cc4640
5 changed files with 92 additions and 39 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue