summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-08-22 15:59:47 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-23 00:02:09 +0200
commit85546af4171c37b6569ea723c3bf28eda6e2894d (patch)
treec19f7b37dce99195d4e25f31b0ee17c6f3ab0f0f /Kernel
parent05e1b196e9999ccd67c73c877acd786468d167c5 (diff)
downloadserenity-85546af4171c37b6569ea723c3bf28eda6e2894d.zip
Kernel: Rename Thread::BlockCondition to BlockerSet
This class represents a set of Thread::Blocker objects attached to something that those blockers are waiting on.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/FileSystem/File.h10
-rw-r--r--Kernel/FileSystem/FileDescription.cpp4
-rw-r--r--Kernel/FileSystem/FileDescription.h4
-rw-r--r--Kernel/FileSystem/Plan9FileSystem.cpp8
-rw-r--r--Kernel/FileSystem/Plan9FileSystem.h8
-rw-r--r--Kernel/FutexQueue.h2
-rw-r--r--Kernel/Net/Routing.cpp8
-rw-r--r--Kernel/Process.cpp4
-rw-r--r--Kernel/Process.h4
-rw-r--r--Kernel/Syscalls/fork.cpp2
-rw-r--r--Kernel/TTY/SlavePTY.cpp4
-rw-r--r--Kernel/TTY/SlavePTY.h2
-rw-r--r--Kernel/Thread.h29
-rw-r--r--Kernel/ThreadBlockers.cpp78
-rw-r--r--Kernel/WaitQueue.h2
15 files changed, 83 insertions, 86 deletions
diff --git a/Kernel/FileSystem/File.h b/Kernel/FileSystem/File.h
index 11ab5269fa..dc5977ee70 100644
--- a/Kernel/FileSystem/File.h
+++ b/Kernel/FileSystem/File.h
@@ -21,9 +21,9 @@ namespace Kernel {
class File;
-class FileBlockCondition final : public Thread::BlockCondition {
+class FileBlockerSet final : public Thread::BlockerSet {
public:
- FileBlockCondition() { }
+ FileBlockerSet() { }
virtual bool should_add_blocker(Thread::Blocker& b, void* data) override
{
@@ -112,7 +112,7 @@ public:
virtual bool is_socket() const { return false; }
virtual bool is_inode_watcher() const { return false; }
- virtual FileBlockCondition& block_condition() { return m_block_condition; }
+ virtual FileBlockerSet& blocker_set() { return m_blocker_set; }
size_t attach_count() const { return m_attach_count; }
@@ -138,10 +138,10 @@ private:
ALWAYS_INLINE void do_evaluate_block_conditions()
{
VERIFY(!Processor::current_in_irq());
- block_condition().unblock();
+ blocker_set().unblock();
}
- FileBlockCondition m_block_condition;
+ FileBlockerSet m_blocker_set;
size_t m_attach_count { 0 };
};
diff --git a/Kernel/FileSystem/FileDescription.cpp b/Kernel/FileSystem/FileDescription.cpp
index 3742a08e58..5b0062f74d 100644
--- a/Kernel/FileSystem/FileDescription.cpp
+++ b/Kernel/FileSystem/FileDescription.cpp
@@ -443,9 +443,9 @@ KResult FileDescription::chown(uid_t uid, gid_t gid)
return m_file->chown(*this, uid, gid);
}
-FileBlockCondition& FileDescription::block_condition()
+FileBlockerSet& FileDescription::blocker_set()
{
- return m_file->block_condition();
+ return m_file->blocker_set();
}
KResult FileDescription::apply_flock(Process const& process, Userspace<flock const*> lock)
diff --git a/Kernel/FileSystem/FileDescription.h b/Kernel/FileSystem/FileDescription.h
index b91121a9ed..d5f3992487 100644
--- a/Kernel/FileSystem/FileDescription.h
+++ b/Kernel/FileSystem/FileDescription.h
@@ -125,7 +125,7 @@ public:
KResult chown(uid_t, gid_t);
- FileBlockCondition& block_condition();
+ FileBlockerSet& blocker_set();
KResult apply_flock(Process const&, Userspace<flock const*>);
KResult get_flock(Userspace<flock*>) const;
@@ -138,7 +138,7 @@ private:
void evaluate_block_conditions()
{
- block_condition().unblock();
+ blocker_set().unblock();
}
RefPtr<Custody> m_custody;
diff --git a/Kernel/FileSystem/Plan9FileSystem.cpp b/Kernel/FileSystem/Plan9FileSystem.cpp
index b1dfa52efe..6861274a55 100644
--- a/Kernel/FileSystem/Plan9FileSystem.cpp
+++ b/Kernel/FileSystem/Plan9FileSystem.cpp
@@ -442,14 +442,14 @@ bool Plan9FS::Blocker::is_completed() const
return m_completion->completed;
}
-bool Plan9FS::Plan9FSBlockCondition::should_add_blocker(Thread::Blocker& b, void*)
+bool Plan9FS::Plan9FSBlockerSet::should_add_blocker(Thread::Blocker& b, void*)
{
// NOTE: m_lock is held already!
auto& blocker = static_cast<Blocker&>(b);
return !blocker.is_completed();
}
-void Plan9FS::Plan9FSBlockCondition::unblock_completed(u16 tag)
+void Plan9FS::Plan9FSBlockerSet::unblock_completed(u16 tag)
{
unblock([&](Thread::Blocker& b, void*, bool&) {
VERIFY(b.blocker_type() == Thread::Blocker::Type::Plan9FS);
@@ -458,7 +458,7 @@ void Plan9FS::Plan9FSBlockCondition::unblock_completed(u16 tag)
});
}
-void Plan9FS::Plan9FSBlockCondition::unblock_all()
+void Plan9FS::Plan9FSBlockerSet::unblock_all()
{
unblock([&](Thread::Blocker& b, void*, bool&) {
VERIFY(b.blocker_type() == Thread::Blocker::Type::Plan9FS);
@@ -467,7 +467,7 @@ void Plan9FS::Plan9FSBlockCondition::unblock_all()
});
}
-void Plan9FS::Plan9FSBlockCondition::try_unblock(Plan9FS::Blocker& blocker)
+void Plan9FS::Plan9FSBlockerSet::try_unblock(Plan9FS::Blocker& blocker)
{
if (m_fs.is_complete(*blocker.completion())) {
SpinlockLocker lock(m_lock);
diff --git a/Kernel/FileSystem/Plan9FileSystem.h b/Kernel/FileSystem/Plan9FileSystem.h
index 105ba05b7a..30788b5d06 100644
--- a/Kernel/FileSystem/Plan9FileSystem.h
+++ b/Kernel/FileSystem/Plan9FileSystem.h
@@ -50,9 +50,9 @@ private:
class Blocker;
- class Plan9FSBlockCondition final : public Thread::BlockCondition {
+ class Plan9FSBlockerSet final : public Thread::BlockerSet {
public:
- Plan9FSBlockCondition(Plan9FS& fs)
+ Plan9FSBlockerSet(Plan9FS& fs)
: m_fs(fs)
{
}
@@ -87,7 +87,7 @@ private:
, m_message(message)
, m_completion(move(completion))
{
- set_block_condition(fs.m_completion_blocker);
+ add_to_blocker_set(fs.m_completion_blocker);
}
virtual StringView state_string() const override { return "Waiting"sv; }
virtual Type blocker_type() const override { return Type::Plan9FS; }
@@ -136,7 +136,7 @@ private:
size_t m_max_message_size { 4 * KiB };
Mutex m_send_lock { "Plan9FS send" };
- Plan9FSBlockCondition m_completion_blocker;
+ Plan9FSBlockerSet m_completion_blocker;
HashMap<u16, NonnullRefPtr<ReceiveCompletion>> m_completions;
Spinlock<u8> m_thread_lock;
diff --git a/Kernel/FutexQueue.h b/Kernel/FutexQueue.h
index 82076716a1..0fe513877a 100644
--- a/Kernel/FutexQueue.h
+++ b/Kernel/FutexQueue.h
@@ -16,7 +16,7 @@ namespace Kernel {
class FutexQueue final
: public RefCounted<FutexQueue>
- , public Thread::BlockCondition {
+ , public Thread::BlockerSet {
public:
FutexQueue();
virtual ~FutexQueue();
diff --git a/Kernel/Net/Routing.cpp b/Kernel/Net/Routing.cpp
index 811faf9f90..2b4d620911 100644
--- a/Kernel/Net/Routing.cpp
+++ b/Kernel/Net/Routing.cpp
@@ -55,11 +55,11 @@ private:
bool m_should_block { true };
};
-class ARPTableBlockCondition final : public Thread::BlockCondition {
+class ARPTableBlockerSet final : public Thread::BlockerSet {
public:
void unblock(const IPv4Address& ip_addr, const MACAddress& addr)
{
- BlockCondition::unblock([&](auto& b, void*, bool&) {
+ BlockerSet::unblock([&](auto& b, void*, bool&) {
VERIFY(b.blocker_type() == Thread::Blocker::Type::Routing);
auto& blocker = static_cast<ARPTableBlocker&>(b);
return blocker.unblock(false, ip_addr, addr);
@@ -80,13 +80,13 @@ protected:
}
};
-static Singleton<ARPTableBlockCondition> s_arp_table_block_condition;
+static Singleton<ARPTableBlockerSet> s_arp_table_block_condition;
ARPTableBlocker::ARPTableBlocker(IPv4Address ip_addr, Optional<MACAddress>& addr)
: m_ip_addr(ip_addr)
, m_addr(addr)
{
- if (!set_block_condition(*s_arp_table_block_condition))
+ if (!add_to_blocker_set(*s_arp_table_block_condition))
m_should_block = false;
}
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index 0d92fa7d2f..7a3370614b 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -184,7 +184,7 @@ RefPtr<Process> Process::create_user_process(RefPtr<Thread>& first_thread, const
register_new(*process);
error = 0;
- // NOTE: All user processes have a leaked ref on them. It's balanced by Thread::WaitBlockCondition::finalize().
+ // NOTE: All user processes have a leaked ref on them. It's balanced by Thread::WaitBlockerSet::finalize().
(void)process.leak_ref();
return process;
@@ -656,7 +656,7 @@ void Process::finalize()
m_space->remove_all_regions({});
VERIFY(ref_count() > 0);
- // WaitBlockCondition::finalize will be in charge of dropping the last
+ // WaitBlockerSet::finalize will be in charge of dropping the last
// reference if there are still waiters around, or whenever the last
// waitable states are consumed. Unless there is no parent around
// anymore, in which case we'll just drop it right away.
diff --git a/Kernel/Process.h b/Kernel/Process.h
index 8e4fc19c9c..d1dce0b5a0 100644
--- a/Kernel/Process.h
+++ b/Kernel/Process.h
@@ -485,7 +485,7 @@ public:
void disowned_by_waiter(Process& process);
void unblock_waiters(Thread::WaitBlocker::UnblockFlags, u8 signal = 0);
- Thread::WaitBlockCondition& wait_block_condition() { return m_wait_block_condition; }
+ Thread::WaitBlockerSet& wait_blocker_set() { return m_wait_block_condition; }
template<typename Callback>
void for_each_coredump_property(Callback callback) const
@@ -787,7 +787,7 @@ private:
// and wait for a tracer to attach.
bool m_wait_for_tracer_at_next_execve { false };
- Thread::WaitBlockCondition m_wait_block_condition;
+ Thread::WaitBlockerSet m_wait_block_condition;
struct CoredumpProperty {
OwnPtr<KString> key;
diff --git a/Kernel/Syscalls/fork.cpp b/Kernel/Syscalls/fork.cpp
index bc4af4b294..df64f4f12e 100644
--- a/Kernel/Syscalls/fork.cpp
+++ b/Kernel/Syscalls/fork.cpp
@@ -126,7 +126,7 @@ KResultOr<FlatPtr> Process::sys$fork(RegisterState& regs)
auto child_pid = child->pid().value();
- // NOTE: All user processes have a leaked ref on them. It's balanced by Thread::WaitBlockCondition::finalize().
+ // NOTE: All user processes have a leaked ref on them. It's balanced by Thread::WaitBlockerSet::finalize().
(void)child.leak_ref();
return child_pid;
diff --git a/Kernel/TTY/SlavePTY.cpp b/Kernel/TTY/SlavePTY.cpp
index f0b608340b..f6bdfc5cdc 100644
--- a/Kernel/TTY/SlavePTY.cpp
+++ b/Kernel/TTY/SlavePTY.cpp
@@ -112,9 +112,9 @@ String SlavePTY::device_name() const
return String::formatted("{}", minor());
}
-FileBlockCondition& SlavePTY::block_condition()
+FileBlockerSet& SlavePTY::blocker_set()
{
- return m_master->block_condition();
+ return m_master->blocker_set();
}
}
diff --git a/Kernel/TTY/SlavePTY.h b/Kernel/TTY/SlavePTY.h
index b8a82f6563..2d71112047 100644
--- a/Kernel/TTY/SlavePTY.h
+++ b/Kernel/TTY/SlavePTY.h
@@ -23,7 +23,7 @@ public:
time_t time_of_last_write() const { return m_time_of_last_write; }
- virtual FileBlockCondition& block_condition() override;
+ virtual FileBlockerSet& blocker_set() override;
private:
// ^TTY
diff --git a/Kernel/Thread.h b/Kernel/Thread.h
index c78193c703..983fc83d4a 100644
--- a/Kernel/Thread.h
+++ b/Kernel/Thread.h
@@ -276,7 +276,7 @@ public:
bool m_should_block { false };
};
- class BlockCondition;
+ class BlockerSet;
class Blocker {
public:
@@ -374,16 +374,13 @@ public:
thread->unblock_from_blocker(*this);
}
- bool set_block_condition(BlockCondition&, void* = nullptr);
- void set_block_condition_raw_locked(BlockCondition* block_condition)
- {
- m_block_condition = block_condition;
- }
+ bool add_to_blocker_set(BlockerSet&, void* = nullptr);
+ void set_blocker_set_raw_locked(BlockerSet* blocker_set) { m_blocker_set = blocker_set; }
mutable RecursiveSpinlock m_lock;
private:
- BlockCondition* m_block_condition { nullptr };
+ BlockerSet* m_blocker_set { nullptr };
void* m_block_data { nullptr };
Thread* m_blocked_thread { nullptr };
u8 m_was_interrupted_by_signal { 0 };
@@ -392,14 +389,14 @@ public:
bool m_did_timeout { false };
};
- class BlockCondition {
- AK_MAKE_NONCOPYABLE(BlockCondition);
- AK_MAKE_NONMOVABLE(BlockCondition);
+ class BlockerSet {
+ AK_MAKE_NONCOPYABLE(BlockerSet);
+ AK_MAKE_NONMOVABLE(BlockerSet);
public:
- BlockCondition() = default;
+ BlockerSet() = default;
- virtual ~BlockCondition()
+ virtual ~BlockerSet()
{
SpinlockLocker lock(m_lock);
VERIFY(m_blockers.is_empty());
@@ -738,11 +735,11 @@ public:
bool m_should_block;
};
- class WaitBlockCondition final : public BlockCondition {
+ class WaitBlockerSet final : public BlockerSet {
friend class WaitBlocker;
public:
- explicit WaitBlockCondition(Process& process)
+ explicit WaitBlockerSet(Process& process)
: m_process(process)
{
}
@@ -1225,7 +1222,7 @@ private:
friend class WaitQueue;
- class JoinBlockCondition final : public BlockCondition {
+ class JoinBlockerSet final : public BlockerSet {
public:
void thread_did_exit(void* exit_value)
{
@@ -1327,7 +1324,7 @@ private:
Vector<HoldingLockInfo> m_holding_locks_list;
#endif
- JoinBlockCondition m_join_condition;
+ JoinBlockerSet m_join_condition;
Atomic<bool, AK::MemoryOrder::memory_order_relaxed> m_is_active { false };
bool m_is_joinable { true };
bool m_handling_page_fault { false };
diff --git a/Kernel/ThreadBlockers.cpp b/Kernel/ThreadBlockers.cpp
index 0bbde36432..c67e30d401 100644
--- a/Kernel/ThreadBlockers.cpp
+++ b/Kernel/ThreadBlockers.cpp
@@ -28,11 +28,11 @@ Thread::BlockTimeout::BlockTimeout(bool is_absolute, const Time* time, const Tim
m_time += m_start_time;
}
-bool Thread::Blocker::set_block_condition(Thread::BlockCondition& block_condition, void* data)
+bool Thread::Blocker::add_to_blocker_set(Thread::BlockerSet& blocker_set, void* data)
{
- VERIFY(!m_block_condition);
- if (block_condition.add_blocker(*this, data)) {
- m_block_condition = &block_condition;
+ VERIFY(!m_blocker_set);
+ if (blocker_set.add_blocker(*this, data)) {
+ m_blocker_set = &blocker_set;
m_block_data = data;
return true;
}
@@ -42,8 +42,8 @@ bool Thread::Blocker::set_block_condition(Thread::BlockCondition& block_conditio
Thread::Blocker::~Blocker()
{
SpinlockLocker lock(m_lock);
- if (m_block_condition)
- m_block_condition->remove_blocker(*this, m_block_data);
+ if (m_blocker_set)
+ m_blocker_set->remove_blocker(*this, m_block_data);
}
void Thread::Blocker::begin_blocking(Badge<Thread>)
@@ -78,7 +78,7 @@ Thread::JoinBlocker::JoinBlocker(Thread& joinee, KResult& try_join_result, void*
// but the joinee is joining immediately
SpinlockLocker lock(m_lock);
try_join_result = joinee.try_join([&]() {
- if (!set_block_condition(joinee.m_join_condition))
+ if (!add_to_blocker_set(joinee.m_join_condition))
m_should_block = false;
});
m_join_error = try_join_result.is_error();
@@ -90,14 +90,14 @@ Thread::JoinBlocker::JoinBlocker(Thread& joinee, KResult& try_join_result, void*
void Thread::JoinBlocker::not_blocking(bool timeout_in_past)
{
if (!m_should_block) {
- // set_block_condition returned false, so unblock was already called
+ // add_to_blocker_set returned false, so unblock was already called
VERIFY(!timeout_in_past);
return;
}
// If we should have blocked but got here it must have been that the
- // timeout was already in the past. So we need to ask the BlockCondition
+ // timeout was already in the past. So we need to ask the BlockerSet
// to supply us the information. We cannot hold the lock as unblock
- // could be called by the BlockCondition at any time!
+ // could be called by the BlockerSet at any time!
VERIFY(timeout_in_past);
m_joinee->m_join_condition.try_unblock(*this);
}
@@ -121,7 +121,7 @@ bool Thread::JoinBlocker::unblock(void* value, bool from_add_blocker)
Thread::QueueBlocker::QueueBlocker(WaitQueue& wait_queue, StringView block_reason)
: m_block_reason(block_reason)
{
- if (!set_block_condition(wait_queue, Thread::current()))
+ if (!add_to_blocker_set(wait_queue, Thread::current()))
m_should_block = false;
}
@@ -145,7 +145,7 @@ bool Thread::QueueBlocker::unblock()
Thread::FutexBlocker::FutexBlocker(FutexQueue& futex_queue, u32 bitset)
: m_bitset(bitset)
{
- if (!set_block_condition(futex_queue, Thread::current()))
+ if (!add_to_blocker_set(futex_queue, Thread::current()))
m_should_block = false;
}
@@ -156,7 +156,7 @@ Thread::FutexBlocker::~FutexBlocker()
void Thread::FutexBlocker::finish_requeue(FutexQueue& futex_queue)
{
VERIFY(m_lock.own_lock());
- set_block_condition_raw_locked(&futex_queue);
+ set_blocker_set_raw_locked(&futex_queue);
// We can now release the lock
m_lock.unlock(m_relock_flags);
}
@@ -194,7 +194,7 @@ Thread::FileDescriptionBlocker::FileDescriptionBlocker(FileDescription& descript
, m_unblocked_flags(unblocked_flags)
{
m_unblocked_flags = BlockFlags::None;
- if (!set_block_condition(description.block_condition()))
+ if (!add_to_blocker_set(description.blocker_set()))
m_should_block = false;
}
@@ -220,19 +220,19 @@ bool Thread::FileDescriptionBlocker::unblock(bool from_add_blocker, void*)
void Thread::FileDescriptionBlocker::not_blocking(bool timeout_in_past)
{
if (!m_should_block) {
- // set_block_condition returned false, so unblock was already called
+ // add_to_blocker_set returned false, so unblock was already called
VERIFY(!timeout_in_past);
return;
}
// If we should have blocked but got here it must have been that the
- // timeout was already in the past. So we need to ask the BlockCondition
+ // timeout was already in the past. So we need to ask the BlockerSet
// to supply us the information. We cannot hold the lock as unblock
- // could be called by the BlockCondition at any time!
+ // could be called by the BlockerSet at any time!
VERIFY(timeout_in_past);
// Just call unblock here because we will query the file description
- // for the data and don't need any input from the FileBlockCondition.
- // However, it's possible that if timeout_in_past is true then FileBlockCondition
+ // 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
// 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
// all the data we need.
@@ -349,7 +349,7 @@ Thread::SelectBlocker::SelectBlocker(FDVector& fds)
if (!m_should_block)
continue;
- if (!fd_entry.description->block_condition().add_blocker(*this, &fd_entry))
+ if (!fd_entry.description->blocker_set().add_blocker(*this, &fd_entry))
m_should_block = false;
}
}
@@ -357,7 +357,7 @@ Thread::SelectBlocker::SelectBlocker(FDVector& fds)
Thread::SelectBlocker::~SelectBlocker()
{
for (auto& fd_entry : m_fds)
- fd_entry.description->block_condition().remove_blocker(*this, &fd_entry);
+ fd_entry.description->blocker_set().remove_blocker(*this, &fd_entry);
}
void Thread::SelectBlocker::not_blocking(bool timeout_in_past)
@@ -434,18 +434,18 @@ void Thread::SelectBlocker::was_unblocked(bool did_timeout)
}
}
-Thread::WaitBlockCondition::ProcessBlockInfo::ProcessBlockInfo(NonnullRefPtr<Process>&& process, WaitBlocker::UnblockFlags flags, u8 signal)
+Thread::WaitBlockerSet::ProcessBlockInfo::ProcessBlockInfo(NonnullRefPtr<Process>&& process, WaitBlocker::UnblockFlags flags, u8 signal)
: process(move(process))
, flags(flags)
, signal(signal)
{
}
-Thread::WaitBlockCondition::ProcessBlockInfo::~ProcessBlockInfo()
+Thread::WaitBlockerSet::ProcessBlockInfo::~ProcessBlockInfo()
{
}
-void Thread::WaitBlockCondition::try_unblock(Thread::WaitBlocker& blocker)
+void Thread::WaitBlockerSet::try_unblock(Thread::WaitBlocker& blocker)
{
SpinlockLocker lock(m_lock);
// We if we have any processes pending
@@ -459,9 +459,9 @@ void Thread::WaitBlockCondition::try_unblock(Thread::WaitBlocker& blocker)
if (blocker.is_wait()) {
if (info.flags == Thread::WaitBlocker::UnblockFlags::Terminated) {
m_processes.remove(i);
- dbgln_if(WAITBLOCK_DEBUG, "WaitBlockCondition[{}] terminated, remove {}", m_process, *info.process);
+ dbgln_if(WAITBLOCK_DEBUG, "WaitBlockerSet[{}] terminated, remove {}", m_process, *info.process);
} else {
- dbgln_if(WAITBLOCK_DEBUG, "WaitBlockCondition[{}] terminated, mark as waited {}", m_process, *info.process);
+ dbgln_if(WAITBLOCK_DEBUG, "WaitBlockerSet[{}] terminated, mark as waited {}", m_process, *info.process);
info.was_waited = true;
}
}
@@ -470,7 +470,7 @@ void Thread::WaitBlockCondition::try_unblock(Thread::WaitBlocker& blocker)
}
}
-void Thread::WaitBlockCondition::disowned_by_waiter(Process& process)
+void Thread::WaitBlockerSet::disowned_by_waiter(Process& process)
{
SpinlockLocker lock(m_lock);
if (m_finalized)
@@ -485,7 +485,7 @@ void Thread::WaitBlockCondition::disowned_by_waiter(Process& process)
VERIFY(did_unblock); // disowning must unblock everyone
return true;
});
- dbgln_if(WAITBLOCK_DEBUG, "WaitBlockCondition[{}] disowned {}", m_process, *info.process);
+ dbgln_if(WAITBLOCK_DEBUG, "WaitBlockerSet[{}] disowned {}", m_process, *info.process);
m_processes.remove(i);
continue;
}
@@ -494,7 +494,7 @@ void Thread::WaitBlockCondition::disowned_by_waiter(Process& process)
}
}
-bool Thread::WaitBlockCondition::unblock(Process& process, WaitBlocker::UnblockFlags flags, u8 signal)
+bool Thread::WaitBlockerSet::unblock(Process& process, WaitBlocker::UnblockFlags flags, u8 signal)
{
VERIFY(flags != WaitBlocker::UnblockFlags::Disowned);
@@ -538,20 +538,20 @@ bool Thread::WaitBlockCondition::unblock(Process& process, WaitBlocker::UnblockF
info.flags = flags;
info.signal = signal;
info.was_waited = did_wait;
- dbgln_if(WAITBLOCK_DEBUG, "WaitBlockCondition[{}] update {} flags={}, waited={}", m_process, process, (int)flags, info.was_waited);
+ dbgln_if(WAITBLOCK_DEBUG, "WaitBlockerSet[{}] update {} flags={}, waited={}", m_process, process, (int)flags, info.was_waited);
updated_existing = true;
break;
}
}
if (!updated_existing) {
- dbgln_if(WAITBLOCK_DEBUG, "WaitBlockCondition[{}] add {} flags: {}", m_process, process, (int)flags);
+ dbgln_if(WAITBLOCK_DEBUG, "WaitBlockerSet[{}] add {} flags: {}", m_process, process, (int)flags);
m_processes.append(ProcessBlockInfo(process, flags, signal));
}
}
return did_unblock_any;
}
-bool Thread::WaitBlockCondition::should_add_blocker(Blocker& b, void*)
+bool Thread::WaitBlockerSet::should_add_blocker(Blocker& b, void*)
{
// NOTE: m_lock is held already!
if (m_finalized)
@@ -571,7 +571,7 @@ bool Thread::WaitBlockCondition::should_add_blocker(Blocker& b, void*)
return true;
}
-void Thread::WaitBlockCondition::finalize()
+void Thread::WaitBlockerSet::finalize()
{
SpinlockLocker lock(m_lock);
VERIFY(!m_finalized);
@@ -619,10 +619,10 @@ Thread::WaitBlocker::WaitBlocker(int wait_options, idtype_t id_type, pid_t id, K
VERIFY_NOT_REACHED();
}
- // NOTE: unblock may be called within set_block_condition, in which
+ // NOTE: unblock may be called within add_to_blocker_set, in which
// case it means that we already have a match without having to block.
- // In that case set_block_condition will return false.
- if (m_error || !set_block_condition(Process::current().wait_block_condition()))
+ // In that case add_to_blocker_set will return false.
+ if (m_error || !add_to_blocker_set(Process::current().wait_blocker_set()))
m_should_block = false;
}
@@ -630,7 +630,7 @@ void Thread::WaitBlocker::not_blocking(bool timeout_in_past)
{
VERIFY(timeout_in_past || !m_should_block);
if (!m_error)
- Process::current().wait_block_condition().try_unblock(*this);
+ Process::current().wait_blocker_set().try_unblock(*this);
}
void Thread::WaitBlocker::was_unblocked(bool)
@@ -643,7 +643,7 @@ void Thread::WaitBlocker::was_unblocked(bool)
}
if (try_unblock)
- Process::current().wait_block_condition().try_unblock(*this);
+ Process::current().wait_blocker_set().try_unblock(*this);
// If we were interrupted by SIGCHLD (which gets special handling
// here) we're not going to return with EINTR. But we're going to
@@ -768,7 +768,7 @@ bool Thread::WaitBlocker::unblock(Process& process, UnblockFlags flags, u8 signa
}
if (!from_add_blocker) {
- // Only call unblock if we weren't called from within set_block_condition!
+ // Only call unblock if we weren't called from within add_to_blocker_set!
VERIFY(flags != UnblockFlags::Disowned);
unblock_from_blocker();
}
diff --git a/Kernel/WaitQueue.h b/Kernel/WaitQueue.h
index 1287da8173..b093feeea8 100644
--- a/Kernel/WaitQueue.h
+++ b/Kernel/WaitQueue.h
@@ -12,7 +12,7 @@
namespace Kernel {
-class WaitQueue final : public Thread::BlockCondition {
+class WaitQueue final : public Thread::BlockerSet {
public:
u32 wake_one();
u32 wake_n(u32 wake_count);