mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:57:35 +00:00
Kernel: Rename Thread::BlockCondition to BlockerSet
This class represents a set of Thread::Blocker objects attached to something that those blockers are waiting on.
This commit is contained in:
parent
05e1b196e9
commit
85546af417
15 changed files with 83 additions and 86 deletions
|
@ -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 };
|
||||
};
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue