diff --git a/Kernel/FileSystem/FIFO.cpp b/Kernel/FileSystem/FIFO.cpp index 87a5c4e628d..ed1daea882f 100644 --- a/Kernel/FileSystem/FIFO.cpp +++ b/Kernel/FileSystem/FIFO.cpp @@ -10,16 +10,16 @@ #include #include #include -#include #include +#include #include #include namespace Kernel { -static AK::Singleton>> s_table; +static AK::Singleton>> s_table; -static Lockable>& all_fifos() +static ProtectedValue>& all_fifos() { return *s_table; } @@ -79,8 +79,9 @@ FIFO::FIFO(uid_t uid, NonnullOwnPtr buffer) : m_buffer(move(buffer)) , m_uid(uid) { - MutexLocker locker(all_fifos().lock()); - all_fifos().resource().set(this); + all_fifos().with_exclusive([&](auto& table) { + table.set(this); + }); m_fifo_id = ++s_next_fifo_id; // Use the same block condition for read and write @@ -91,8 +92,9 @@ FIFO::FIFO(uid_t uid, NonnullOwnPtr buffer) FIFO::~FIFO() { - MutexLocker locker(all_fifos().lock()); - all_fifos().resource().remove(this); + all_fifos().with_exclusive([&](auto& table) { + table.remove(this); + }); } void FIFO::attach(Direction direction)