mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:17:44 +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
|
@ -425,6 +425,11 @@ bool Plan9FS::Blocker::unblock(u16 tag)
|
|||
return unblock();
|
||||
}
|
||||
|
||||
bool Plan9FS::Blocker::setup_blocker()
|
||||
{
|
||||
return add_to_blocker_set(m_fs.m_completion_blocker);
|
||||
}
|
||||
|
||||
void Plan9FS::Blocker::will_unblock_immediately_without_blocking(UnblockImmediatelyReason)
|
||||
{
|
||||
{
|
||||
|
|
|
@ -87,8 +87,8 @@ private:
|
|||
, m_message(message)
|
||||
, m_completion(move(completion))
|
||||
{
|
||||
add_to_blocker_set(fs.m_completion_blocker);
|
||||
}
|
||||
virtual bool setup_blocker() override;
|
||||
virtual StringView state_string() const override { return "Waiting"sv; }
|
||||
virtual Type blocker_type() const override { return Type::Plan9FS; }
|
||||
virtual void will_unblock_immediately_without_blocking(UnblockImmediatelyReason) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue