Browse Source

Kernel: Rename FileBlocker::unblock() => unblock_if_conditions_are_met()

Since this may not actually unblock, the old name was very confusing.
Andreas Kling 3 years ago
parent
commit
e851a77346
3 changed files with 9 additions and 9 deletions
  1. 2 2
      Kernel/FileSystem/File.h
  2. 3 3
      Kernel/Thread.h
  3. 4 4
      Kernel/ThreadBlockers.cpp

+ 2 - 2
Kernel/FileSystem/File.h

@@ -29,7 +29,7 @@ public:
     {
     {
         VERIFY(b.blocker_type() == Thread::Blocker::Type::File);
         VERIFY(b.blocker_type() == Thread::Blocker::Type::File);
         auto& blocker = static_cast<Thread::FileBlocker&>(b);
         auto& blocker = static_cast<Thread::FileBlocker&>(b);
-        return !blocker.unblock(true, data);
+        return !blocker.unblock_if_conditions_are_met(true, data);
     }
     }
 
 
     void unblock_all_blockers_whose_conditions_are_met()
     void unblock_all_blockers_whose_conditions_are_met()
@@ -38,7 +38,7 @@ public:
         BlockerSet::unblock_all_blockers_whose_conditions_are_met_locked([&](auto& b, void* data, bool&) {
         BlockerSet::unblock_all_blockers_whose_conditions_are_met_locked([&](auto& b, void* data, bool&) {
             VERIFY(b.blocker_type() == Thread::Blocker::Type::File);
             VERIFY(b.blocker_type() == Thread::Blocker::Type::File);
             auto& blocker = static_cast<Thread::FileBlocker&>(b);
             auto& blocker = static_cast<Thread::FileBlocker&>(b);
-            return blocker.unblock(false, data);
+            return blocker.unblock_if_conditions_are_met(false, data);
         });
         });
     }
     }
 };
 };

+ 3 - 3
Kernel/Thread.h

@@ -602,14 +602,14 @@ public:
 
 
         virtual Type blocker_type() const override { return Type::File; }
         virtual Type blocker_type() const override { return Type::File; }
 
 
-        virtual bool unblock(bool, void*) = 0;
+        virtual bool unblock_if_conditions_are_met(bool, void*) = 0;
     };
     };
 
 
     class FileDescriptionBlocker : public FileBlocker {
     class FileDescriptionBlocker : public FileBlocker {
     public:
     public:
         const FileDescription& blocked_description() const;
         const FileDescription& blocked_description() const;
 
 
-        virtual bool unblock(bool, void*) override;
+        virtual bool unblock_if_conditions_are_met(bool, void*) override;
         virtual void will_unblock_immediately_without_blocking(UnblockImmediatelyReason) override;
         virtual void will_unblock_immediately_without_blocking(UnblockImmediatelyReason) override;
         virtual bool setup_blocker() override;
         virtual bool setup_blocker() override;
 
 
@@ -684,7 +684,7 @@ public:
         explicit SelectBlocker(FDVector&);
         explicit SelectBlocker(FDVector&);
         virtual ~SelectBlocker();
         virtual ~SelectBlocker();
 
 
-        virtual bool unblock(bool, void*) override;
+        virtual bool unblock_if_conditions_are_met(bool, void*) override;
         virtual void will_unblock_immediately_without_blocking(UnblockImmediatelyReason) override;
         virtual void will_unblock_immediately_without_blocking(UnblockImmediatelyReason) override;
         virtual void was_unblocked(bool) override;
         virtual void was_unblocked(bool) override;
         virtual StringView state_string() const override { return "Selecting"sv; }
         virtual StringView state_string() const override { return "Selecting"sv; }

+ 4 - 4
Kernel/ThreadBlockers.cpp

@@ -208,7 +208,7 @@ bool Thread::FileDescriptionBlocker::setup_blocker()
     return add_to_blocker_set(m_blocked_description->blocker_set());
     return add_to_blocker_set(m_blocked_description->blocker_set());
 }
 }
 
 
-bool Thread::FileDescriptionBlocker::unblock(bool from_add_blocker, void*)
+bool Thread::FileDescriptionBlocker::unblock_if_conditions_are_met(bool from_add_blocker, void*)
 {
 {
     auto unblock_flags = m_blocked_description->should_unblock(m_flags);
     auto unblock_flags = m_blocked_description->should_unblock(m_flags);
     if (unblock_flags == BlockFlags::None)
     if (unblock_flags == BlockFlags::None)
@@ -238,13 +238,13 @@ void Thread::FileDescriptionBlocker::will_unblock_immediately_without_blocking(U
     // could be called by the BlockerSet at any time!
     // could be called by the BlockerSet at any time!
     VERIFY(reason == UnblockImmediatelyReason::TimeoutInThePast);
     VERIFY(reason == UnblockImmediatelyReason::TimeoutInThePast);
 
 
-    // Just call unblock here because we will query the file description
+    // Just call unblock_if_conditions_are_met here because we will query the file description
     // for the data and don't need any input from the FileBlockerSet.
     // for the data and don't need any input from the FileBlockerSet.
     // However, it's possible that if timeout_in_past is true then FileBlockerSet
     // However, it's possible that if timeout_in_past is true then FileBlockerSet
     // may call us at any given time, so our call to unblock here may fail.
     // may call us at any given time, so our call to unblock here may fail.
     // Either way, unblock will be called at least once, which provides
     // Either way, unblock will be called at least once, which provides
     // all the data we need.
     // all the data we need.
-    unblock(false, nullptr);
+    unblock_if_conditions_are_met(false, nullptr);
 }
 }
 
 
 const FileDescription& Thread::FileDescriptionBlocker::blocked_description() const
 const FileDescription& Thread::FileDescriptionBlocker::blocked_description() const
@@ -386,7 +386,7 @@ void Thread::SelectBlocker::will_unblock_immediately_without_blocking(UnblockImm
     }
     }
 }
 }
 
 
-bool Thread::SelectBlocker::unblock(bool from_add_blocker, void* data)
+bool Thread::SelectBlocker::unblock_if_conditions_are_met(bool from_add_blocker, void* data)
 {
 {
     VERIFY(data); // data is a pointer to an entry in the m_fds vector
     VERIFY(data); // data is a pointer to an entry in the m_fds vector
     auto& fd_info = *static_cast<FDInfo*>(data);
     auto& fd_info = *static_cast<FDInfo*>(data);