From cfd9045891cf1efe7f2226f176ff2610a1aa56d0 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 24 Aug 2021 12:35:20 +0200 Subject: [PATCH] Kernel: Remove unused Thread::Blocker::should_block() virtual This was previously used after construction to check for early unblock conditions that couldn't be communicated from the constructor. Now that we've moved early unblock checks from the constructor into setup_blocker(), we don't need should_block() anymore. --- Kernel/Net/Routing.cpp | 1 - Kernel/Thread.h | 11 ----------- 2 files changed, 12 deletions(-) diff --git a/Kernel/Net/Routing.cpp b/Kernel/Net/Routing.cpp index b4c6384463..8d8e2482e7 100644 --- a/Kernel/Net/Routing.cpp +++ b/Kernel/Net/Routing.cpp @@ -24,7 +24,6 @@ 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; diff --git a/Kernel/Thread.h b/Kernel/Thread.h index ffe37946a1..6f837e8522 100644 --- a/Kernel/Thread.h +++ b/Kernel/Thread.h @@ -266,7 +266,6 @@ public: const Time* start_time() const { return !m_infinite ? &m_start_time : nullptr; } clockid_t clock_id() const { return m_clock_id; } bool is_infinite() const { return m_infinite; } - bool should_block() const { return m_infinite || m_should_block; }; private: Time m_time {}; @@ -296,7 +295,6 @@ public: }; virtual ~Blocker(); virtual StringView state_string() const = 0; - virtual bool should_block() { return true; } virtual Type blocker_type() const = 0; virtual const BlockTimeout& override_timeout(const BlockTimeout& timeout) { return timeout; } virtual bool can_be_interrupted() const { return true; } @@ -521,7 +519,6 @@ public: virtual Type blocker_type() const override { return Type::Join; } virtual StringView state_string() const override { return "Joining"sv; } virtual bool can_be_interrupted() const override { return false; } - virtual bool should_block() override { return !m_join_error && m_should_block; } virtual void will_unblock_immediately_without_blocking(UnblockImmediatelyReason) override; virtual bool setup_blocker() override; @@ -545,7 +542,6 @@ public: virtual Type blocker_type() const override { return Type::Queue; } virtual StringView state_string() const override { return m_block_reason.is_null() ? m_block_reason : "Queue"sv; } virtual void will_unblock_immediately_without_blocking(UnblockImmediatelyReason) override { } - virtual bool should_block() override { return m_should_block; } virtual bool setup_blocker() override; bool unblock(); @@ -565,7 +561,6 @@ public: virtual Type blocker_type() const override { return Type::Futex; } virtual StringView state_string() const override { return "Futex"sv; } virtual void will_unblock_immediately_without_blocking(UnblockImmediatelyReason) override { } - virtual bool should_block() override { return m_should_block; } virtual bool setup_blocker() override; u32 bitset() const { return m_bitset; } @@ -610,11 +605,6 @@ public: virtual Type blocker_type() const override { return Type::File; } - virtual bool should_block() override - { - return m_should_block; - } - virtual bool unblock(bool, void*) = 0; protected: @@ -725,7 +715,6 @@ public: WaitBlocker(int wait_options, idtype_t id_type, pid_t id, KResultOr& result); virtual StringView state_string() const override { return "Waiting"sv; } virtual Type blocker_type() const override { return Type::Wait; } - virtual bool should_block() override { return m_should_block; } virtual void will_unblock_immediately_without_blocking(UnblockImmediatelyReason) override; virtual void was_unblocked(bool) override; virtual bool setup_blocker() override;