mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-12 22:22:55 +00:00
Kernel: Rename QueueBlocker => WaitQueueBlocker
This is a Thread::Blocker that blocks on a WaitQueue, so let's call it a WaitQueueBlocker to improve clarity. :^)
This commit is contained in:
parent
b30081b49a
commit
40bc378d81
Notes:
sideshowbarker
2024-07-18 05:22:23 +09:00
Author: https://github.com/awesomekling
Commit: 40bc378d81
4 changed files with 12 additions and 12 deletions
|
@ -522,10 +522,10 @@ public:
|
||||||
bool m_should_block { true };
|
bool m_should_block { true };
|
||||||
};
|
};
|
||||||
|
|
||||||
class QueueBlocker final : public Blocker {
|
class WaitQueueBlocker final : public Blocker {
|
||||||
public:
|
public:
|
||||||
explicit QueueBlocker(WaitQueue&, StringView block_reason = {});
|
explicit WaitQueueBlocker(WaitQueue&, StringView block_reason = {});
|
||||||
virtual ~QueueBlocker();
|
virtual ~WaitQueueBlocker();
|
||||||
|
|
||||||
virtual Type blocker_type() const override { return Type::Queue; }
|
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 StringView state_string() const override { return m_block_reason.is_null() ? m_block_reason : "Queue"sv; }
|
||||||
|
@ -981,7 +981,7 @@ public:
|
||||||
Thread::BlockResult wait_on(WaitQueue& wait_queue, const Thread::BlockTimeout& timeout, Args&&... args)
|
Thread::BlockResult wait_on(WaitQueue& wait_queue, const Thread::BlockTimeout& timeout, Args&&... args)
|
||||||
{
|
{
|
||||||
VERIFY(this == Thread::current());
|
VERIFY(this == Thread::current());
|
||||||
return block<Thread::QueueBlocker>(timeout, wait_queue, forward<Args>(args)...);
|
return block<Thread::WaitQueueBlocker>(timeout, wait_queue, forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockResult sleep(clockid_t, const Time&, Time* = nullptr);
|
BlockResult sleep(clockid_t, const Time&, Time* = nullptr);
|
||||||
|
|
|
@ -118,18 +118,18 @@ bool Thread::JoinBlocker::unblock(void* value, bool from_add_blocker)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread::QueueBlocker::QueueBlocker(WaitQueue& wait_queue, StringView block_reason)
|
Thread::WaitQueueBlocker::WaitQueueBlocker(WaitQueue& wait_queue, StringView block_reason)
|
||||||
: m_block_reason(block_reason)
|
: m_block_reason(block_reason)
|
||||||
{
|
{
|
||||||
if (!add_to_blocker_set(wait_queue, Thread::current()))
|
if (!add_to_blocker_set(wait_queue, Thread::current()))
|
||||||
m_should_block = false;
|
m_should_block = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread::QueueBlocker::~QueueBlocker()
|
Thread::WaitQueueBlocker::~WaitQueueBlocker()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Thread::QueueBlocker::unblock()
|
bool Thread::WaitQueueBlocker::unblock()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
SpinlockLocker lock(m_lock);
|
SpinlockLocker lock(m_lock);
|
||||||
|
|
|
@ -32,7 +32,7 @@ u32 WaitQueue::wake_one()
|
||||||
bool did_unblock_one = unblock_all_blockers_whose_conditions_are_met_locked([&](Thread::Blocker& b, void* data, bool& stop_iterating) {
|
bool did_unblock_one = unblock_all_blockers_whose_conditions_are_met_locked([&](Thread::Blocker& b, void* data, bool& stop_iterating) {
|
||||||
VERIFY(data);
|
VERIFY(data);
|
||||||
VERIFY(b.blocker_type() == Thread::Blocker::Type::Queue);
|
VERIFY(b.blocker_type() == Thread::Blocker::Type::Queue);
|
||||||
auto& blocker = static_cast<Thread::QueueBlocker&>(b);
|
auto& blocker = static_cast<Thread::WaitQueueBlocker&>(b);
|
||||||
dbgln_if(WAITQUEUE_DEBUG, "WaitQueue @ {}: wake_one unblocking {}", this, data);
|
dbgln_if(WAITQUEUE_DEBUG, "WaitQueue @ {}: wake_one unblocking {}", this, data);
|
||||||
if (blocker.unblock()) {
|
if (blocker.unblock()) {
|
||||||
stop_iterating = true;
|
stop_iterating = true;
|
||||||
|
@ -57,7 +57,7 @@ u32 WaitQueue::wake_n(u32 wake_count)
|
||||||
bool did_unblock_some = unblock_all_blockers_whose_conditions_are_met_locked([&](Thread::Blocker& b, void* data, bool& stop_iterating) {
|
bool did_unblock_some = unblock_all_blockers_whose_conditions_are_met_locked([&](Thread::Blocker& b, void* data, bool& stop_iterating) {
|
||||||
VERIFY(data);
|
VERIFY(data);
|
||||||
VERIFY(b.blocker_type() == Thread::Blocker::Type::Queue);
|
VERIFY(b.blocker_type() == Thread::Blocker::Type::Queue);
|
||||||
auto& blocker = static_cast<Thread::QueueBlocker&>(b);
|
auto& blocker = static_cast<Thread::WaitQueueBlocker&>(b);
|
||||||
dbgln_if(WAITQUEUE_DEBUG, "WaitQueue @ {}: wake_n unblocking {}", this, data);
|
dbgln_if(WAITQUEUE_DEBUG, "WaitQueue @ {}: wake_n unblocking {}", this, data);
|
||||||
VERIFY(did_wake < wake_count);
|
VERIFY(did_wake < wake_count);
|
||||||
if (blocker.unblock()) {
|
if (blocker.unblock()) {
|
||||||
|
@ -82,7 +82,7 @@ u32 WaitQueue::wake_all()
|
||||||
bool did_unblock_any = unblock_all_blockers_whose_conditions_are_met_locked([&](Thread::Blocker& b, void* data, bool&) {
|
bool did_unblock_any = unblock_all_blockers_whose_conditions_are_met_locked([&](Thread::Blocker& b, void* data, bool&) {
|
||||||
VERIFY(data);
|
VERIFY(data);
|
||||||
VERIFY(b.blocker_type() == Thread::Blocker::Type::Queue);
|
VERIFY(b.blocker_type() == Thread::Blocker::Type::Queue);
|
||||||
auto& blocker = static_cast<Thread::QueueBlocker&>(b);
|
auto& blocker = static_cast<Thread::WaitQueueBlocker&>(b);
|
||||||
|
|
||||||
dbgln_if(WAITQUEUE_DEBUG, "WaitQueue @ {}: wake_all unblocking {}", this, data);
|
dbgln_if(WAITQUEUE_DEBUG, "WaitQueue @ {}: wake_all unblocking {}", this, data);
|
||||||
|
|
||||||
|
|
|
@ -27,13 +27,13 @@ public:
|
||||||
template<class... Args>
|
template<class... Args>
|
||||||
Thread::BlockResult wait_on(const Thread::BlockTimeout& timeout, Args&&... args)
|
Thread::BlockResult wait_on(const Thread::BlockTimeout& timeout, Args&&... args)
|
||||||
{
|
{
|
||||||
return Thread::current()->block<Thread::QueueBlocker>(timeout, *this, forward<Args>(args)...);
|
return Thread::current()->block<Thread::WaitQueueBlocker>(timeout, *this, forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class... Args>
|
template<class... Args>
|
||||||
void wait_forever(Args&&... args)
|
void wait_forever(Args&&... args)
|
||||||
{
|
{
|
||||||
(void)Thread::current()->block<Thread::QueueBlocker>({}, *this, forward<Args>(args)...);
|
(void)Thread::current()->block<Thread::WaitQueueBlocker>({}, *this, forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue