mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 18:10:56 +09:00
Kernel: Simplify Blockers so they don't need a "should block" flag
The `m_should_block` member variable that many of the Thread::Blocker subclasses had was really only used to carry state from the constructor to the immediate-unblock-without-blocking escape hatch. This patch refactors the blockers so that we don't need to hold on to this flag after setup_blocker(), and instead the return value from setup_blocker() is the authority on whether the unblock conditions are already met.
This commit is contained in:
parent
adbf472ca7
commit
0c1d41cc8a
Notes:
sideshowbarker
2024-07-18 05:19:40 +09:00
Author: https://github.com/awesomekling
Commit: 0c1d41cc8a
3 changed files with 26 additions and 51 deletions
|
@ -528,9 +528,7 @@ public:
|
|||
NonnullRefPtr<Thread> m_joinee;
|
||||
void*& m_joinee_exit_value;
|
||||
KResult& m_try_join_result;
|
||||
bool m_join_error { false };
|
||||
bool m_did_unblock { false };
|
||||
bool m_should_block { true };
|
||||
};
|
||||
|
||||
class WaitQueueBlocker final : public Blocker {
|
||||
|
@ -548,7 +546,6 @@ public:
|
|||
protected:
|
||||
WaitQueue& m_wait_queue;
|
||||
StringView m_block_reason;
|
||||
bool m_should_block { true };
|
||||
bool m_did_unblock { false };
|
||||
};
|
||||
|
||||
|
@ -578,7 +575,6 @@ public:
|
|||
FutexQueue& m_futex_queue;
|
||||
u32 m_bitset { 0 };
|
||||
u32 m_relock_flags { 0 };
|
||||
bool m_should_block { true };
|
||||
bool m_did_unblock { false };
|
||||
};
|
||||
|
||||
|
@ -605,9 +601,6 @@ public:
|
|||
virtual Type blocker_type() const override { return Type::File; }
|
||||
|
||||
virtual bool unblock(bool, void*) = 0;
|
||||
|
||||
protected:
|
||||
bool m_should_block { true };
|
||||
};
|
||||
|
||||
class FileDescriptionBlocker : public FileBlocker {
|
||||
|
@ -734,7 +727,6 @@ public:
|
|||
bool m_did_unblock { false };
|
||||
bool m_error { false };
|
||||
bool m_got_sigchild { false };
|
||||
bool m_should_block;
|
||||
};
|
||||
|
||||
class WaitBlockerSet final : public BlockerSet {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue