mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:28:10 +00:00
Kernel: Rename ProtectedValue<T> => MutexProtected<T>
Let's make it obvious what we're protecting it with.
This commit is contained in:
parent
81d990b551
commit
c2fc33becd
18 changed files with 57 additions and 56 deletions
|
@ -7,7 +7,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Kernel/FileSystem/FileBackedFileSystem.h>
|
#include <Kernel/FileSystem/FileBackedFileSystem.h>
|
||||||
#include <Kernel/Locking/ProtectedValue.h>
|
#include <Kernel/Locking/MutexProtected.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ private:
|
||||||
DiskCache& cache() const;
|
DiskCache& cache() const;
|
||||||
void flush_specific_block_if_needed(BlockIndex index);
|
void flush_specific_block_if_needed(BlockIndex index);
|
||||||
|
|
||||||
mutable ProtectedValue<OwnPtr<DiskCache>> m_cache;
|
mutable MutexProtected<OwnPtr<DiskCache>> m_cache;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,13 @@
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
#include <Kernel/FileSystem/Custody.h>
|
#include <Kernel/FileSystem/Custody.h>
|
||||||
#include <Kernel/FileSystem/Inode.h>
|
#include <Kernel/FileSystem/Inode.h>
|
||||||
#include <Kernel/Locking/ProtectedValue.h>
|
#include <Kernel/Locking/MutexProtected.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
static Singleton<ProtectedValue<Custody::AllCustodiesList>> s_all_custodies;
|
static Singleton<MutexProtected<Custody::AllCustodiesList>> s_all_custodies;
|
||||||
|
|
||||||
static ProtectedValue<Custody::AllCustodiesList>& all_custodies()
|
static MutexProtected<Custody::AllCustodiesList>& all_custodies()
|
||||||
{
|
{
|
||||||
return s_all_custodies;
|
return s_all_custodies;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <Kernel/FileSystem/UnveilNode.h>
|
#include <Kernel/FileSystem/UnveilNode.h>
|
||||||
#include <Kernel/Forward.h>
|
#include <Kernel/Forward.h>
|
||||||
#include <Kernel/KResult.h>
|
#include <Kernel/KResult.h>
|
||||||
#include <Kernel/Locking/ProtectedValue.h>
|
#include <Kernel/Locking/MutexProtected.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ private:
|
||||||
RefPtr<Inode> m_root_inode;
|
RefPtr<Inode> m_root_inode;
|
||||||
RefPtr<Custody> m_root_custody;
|
RefPtr<Custody> m_root_custody;
|
||||||
|
|
||||||
ProtectedValue<Vector<Mount, 16>> m_mounts;
|
MutexProtected<Vector<Mount, 16>> m_mounts;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,15 +36,15 @@ private:
|
||||||
MutexLocker m_mutex_locker;
|
MutexLocker m_mutex_locker;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ContendedResource {
|
class MutexContendedResource {
|
||||||
template<typename, LockMode>
|
template<typename, LockMode>
|
||||||
friend class LockedResource;
|
friend class LockedResource;
|
||||||
|
|
||||||
AK_MAKE_NONCOPYABLE(ContendedResource);
|
AK_MAKE_NONCOPYABLE(MutexContendedResource);
|
||||||
AK_MAKE_NONMOVABLE(ContendedResource);
|
AK_MAKE_NONMOVABLE(MutexContendedResource);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ContendedResource() = default;
|
MutexContendedResource() = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
mutable Mutex m_mutex;
|
mutable Mutex m_mutex;
|
|
@ -6,28 +6,29 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Kernel/Locking/ContendedResource.h>
|
|
||||||
#include <Kernel/Locking/LockLocation.h>
|
#include <Kernel/Locking/LockLocation.h>
|
||||||
|
#include <Kernel/Locking/MutexContendedResource.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class ProtectedValue : private T
|
class MutexProtected
|
||||||
, public ContendedResource {
|
: private T
|
||||||
AK_MAKE_NONCOPYABLE(ProtectedValue);
|
, public MutexContendedResource {
|
||||||
AK_MAKE_NONMOVABLE(ProtectedValue);
|
AK_MAKE_NONCOPYABLE(MutexProtected);
|
||||||
|
AK_MAKE_NONMOVABLE(MutexProtected);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
using LockedShared = LockedResource<T const, LockMode::Shared>;
|
using LockedShared = LockedResource<T const, LockMode::Shared>;
|
||||||
using LockedExclusive = LockedResource<T, LockMode::Exclusive>;
|
using LockedExclusive = LockedResource<T, LockMode::Exclusive>;
|
||||||
|
|
||||||
LockedShared lock_shared(LockLocation const& location) const { return LockedShared(this, this->ContendedResource::m_mutex, location); }
|
LockedShared lock_shared(LockLocation const& location) const { return LockedShared(this, this->MutexContendedResource::m_mutex, location); }
|
||||||
LockedExclusive lock_exclusive(LockLocation const& location) { return LockedExclusive(this, this->ContendedResource::m_mutex, location); }
|
LockedExclusive lock_exclusive(LockLocation const& location) { return LockedExclusive(this, this->MutexContendedResource::m_mutex, location); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using T::T;
|
using T::T;
|
||||||
|
|
||||||
ProtectedValue() = default;
|
MutexProtected() = default;
|
||||||
|
|
||||||
template<typename Callback>
|
template<typename Callback>
|
||||||
decltype(auto) with_shared(Callback callback, LockLocation const& location = LockLocation::current()) const
|
decltype(auto) with_shared(Callback callback, LockLocation const& location = LockLocation::current()) const
|
|
@ -26,11 +26,11 @@
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
static Singleton<ProtectedValue<IPv4Socket::List>> s_all_sockets;
|
static Singleton<MutexProtected<IPv4Socket::List>> s_all_sockets;
|
||||||
|
|
||||||
using BlockFlags = Thread::FileDescriptionBlocker::BlockFlags;
|
using BlockFlags = Thread::FileDescriptionBlocker::BlockFlags;
|
||||||
|
|
||||||
ProtectedValue<IPv4Socket::List>& IPv4Socket::all_sockets()
|
MutexProtected<IPv4Socket::List>& IPv4Socket::all_sockets()
|
||||||
{
|
{
|
||||||
return *s_all_sockets;
|
return *s_all_sockets;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <AK/SinglyLinkedListWithCount.h>
|
#include <AK/SinglyLinkedListWithCount.h>
|
||||||
#include <Kernel/DoubleBuffer.h>
|
#include <Kernel/DoubleBuffer.h>
|
||||||
#include <Kernel/KBuffer.h>
|
#include <Kernel/KBuffer.h>
|
||||||
#include <Kernel/Locking/ProtectedValue.h>
|
#include <Kernel/Locking/MutexProtected.h>
|
||||||
#include <Kernel/Net/IPv4.h>
|
#include <Kernel/Net/IPv4.h>
|
||||||
#include <Kernel/Net/IPv4SocketTuple.h>
|
#include <Kernel/Net/IPv4SocketTuple.h>
|
||||||
#include <Kernel/Net/Socket.h>
|
#include <Kernel/Net/Socket.h>
|
||||||
|
@ -135,7 +135,7 @@ private:
|
||||||
public:
|
public:
|
||||||
using List = IntrusiveList<IPv4Socket, RawPtr<IPv4Socket>, &IPv4Socket::m_list_node>;
|
using List = IntrusiveList<IPv4Socket, RawPtr<IPv4Socket>, &IPv4Socket::m_list_node>;
|
||||||
|
|
||||||
static ProtectedValue<IPv4Socket::List>& all_sockets();
|
static MutexProtected<IPv4Socket::List>& all_sockets();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <Kernel/FileSystem/FileDescription.h>
|
#include <Kernel/FileSystem/FileDescription.h>
|
||||||
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
||||||
#include <Kernel/Locking/Mutex.h>
|
#include <Kernel/Locking/Mutex.h>
|
||||||
#include <Kernel/Locking/ProtectedValue.h>
|
#include <Kernel/Locking/MutexProtected.h>
|
||||||
#include <Kernel/Net/LocalSocket.h>
|
#include <Kernel/Net/LocalSocket.h>
|
||||||
#include <Kernel/Process.h>
|
#include <Kernel/Process.h>
|
||||||
#include <Kernel/StdLib.h>
|
#include <Kernel/StdLib.h>
|
||||||
|
@ -19,9 +19,9 @@
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
static Singleton<ProtectedValue<LocalSocket::List>> s_list;
|
static Singleton<MutexProtected<LocalSocket::List>> s_list;
|
||||||
|
|
||||||
static ProtectedValue<LocalSocket::List>& all_sockets()
|
static MutexProtected<LocalSocket::List>& all_sockets()
|
||||||
{
|
{
|
||||||
return *s_list;
|
return *s_list;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include <Kernel/Debug.h>
|
#include <Kernel/Debug.h>
|
||||||
#include <Kernel/Locking/Mutex.h>
|
#include <Kernel/Locking/Mutex.h>
|
||||||
#include <Kernel/Locking/ProtectedValue.h>
|
#include <Kernel/Locking/MutexProtected.h>
|
||||||
#include <Kernel/Net/ARP.h>
|
#include <Kernel/Net/ARP.h>
|
||||||
#include <Kernel/Net/EtherType.h>
|
#include <Kernel/Net/EtherType.h>
|
||||||
#include <Kernel/Net/EthernetFrameHeader.h>
|
#include <Kernel/Net/EthernetFrameHeader.h>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include <AK/HashMap.h>
|
#include <AK/HashMap.h>
|
||||||
#include <AK/Singleton.h>
|
#include <AK/Singleton.h>
|
||||||
#include <Kernel/Debug.h>
|
#include <Kernel/Debug.h>
|
||||||
#include <Kernel/Locking/ProtectedValue.h>
|
#include <Kernel/Locking/MutexProtected.h>
|
||||||
#include <Kernel/Net/LoopbackAdapter.h>
|
#include <Kernel/Net/LoopbackAdapter.h>
|
||||||
#include <Kernel/Net/NetworkTask.h>
|
#include <Kernel/Net/NetworkTask.h>
|
||||||
#include <Kernel/Net/NetworkingManagement.h>
|
#include <Kernel/Net/NetworkingManagement.h>
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
static Singleton<ProtectedValue<HashMap<IPv4Address, MACAddress>>> s_arp_table;
|
static Singleton<MutexProtected<HashMap<IPv4Address, MACAddress>>> s_arp_table;
|
||||||
|
|
||||||
class ARPTableBlocker : public Thread::Blocker {
|
class ARPTableBlocker : public Thread::Blocker {
|
||||||
public:
|
public:
|
||||||
|
@ -104,7 +104,7 @@ void ARPTableBlocker::not_blocking(bool timeout_in_past)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ProtectedValue<HashMap<IPv4Address, MACAddress>>& arp_table()
|
MutexProtected<HashMap<IPv4Address, MACAddress>>& arp_table()
|
||||||
{
|
{
|
||||||
return *s_arp_table;
|
return *s_arp_table;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Kernel/Locking/ProtectedValue.h>
|
#include <Kernel/Locking/MutexProtected.h>
|
||||||
#include <Kernel/Net/NetworkAdapter.h>
|
#include <Kernel/Net/NetworkAdapter.h>
|
||||||
#include <Kernel/Thread.h>
|
#include <Kernel/Thread.h>
|
||||||
|
|
||||||
|
@ -27,6 +27,6 @@ enum class UpdateArp {
|
||||||
void update_arp_table(const IPv4Address&, const MACAddress&, UpdateArp update);
|
void update_arp_table(const IPv4Address&, const MACAddress&, UpdateArp update);
|
||||||
RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source, const RefPtr<NetworkAdapter> through = nullptr);
|
RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source, const RefPtr<NetworkAdapter> through = nullptr);
|
||||||
|
|
||||||
ProtectedValue<HashMap<IPv4Address, MACAddress>>& arp_table();
|
MutexProtected<HashMap<IPv4Address, MACAddress>>& arp_table();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <Kernel/Debug.h>
|
#include <Kernel/Debug.h>
|
||||||
#include <Kernel/Devices/RandomDevice.h>
|
#include <Kernel/Devices/RandomDevice.h>
|
||||||
#include <Kernel/FileSystem/FileDescription.h>
|
#include <Kernel/FileSystem/FileDescription.h>
|
||||||
#include <Kernel/Locking/ProtectedValue.h>
|
#include <Kernel/Locking/MutexProtected.h>
|
||||||
#include <Kernel/Net/EthernetFrameHeader.h>
|
#include <Kernel/Net/EthernetFrameHeader.h>
|
||||||
#include <Kernel/Net/IPv4.h>
|
#include <Kernel/Net/IPv4.h>
|
||||||
#include <Kernel/Net/NetworkAdapter.h>
|
#include <Kernel/Net/NetworkAdapter.h>
|
||||||
|
@ -56,16 +56,16 @@ void TCPSocket::set_state(State new_state)
|
||||||
evaluate_block_conditions();
|
evaluate_block_conditions();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Singleton<ProtectedValue<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>> s_socket_closing;
|
static Singleton<MutexProtected<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>> s_socket_closing;
|
||||||
|
|
||||||
ProtectedValue<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>& TCPSocket::closing_sockets()
|
MutexProtected<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>& TCPSocket::closing_sockets()
|
||||||
{
|
{
|
||||||
return *s_socket_closing;
|
return *s_socket_closing;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Singleton<ProtectedValue<HashMap<IPv4SocketTuple, TCPSocket*>>> s_socket_tuples;
|
static Singleton<MutexProtected<HashMap<IPv4SocketTuple, TCPSocket*>>> s_socket_tuples;
|
||||||
|
|
||||||
ProtectedValue<HashMap<IPv4SocketTuple, TCPSocket*>>& TCPSocket::sockets_by_tuple()
|
MutexProtected<HashMap<IPv4SocketTuple, TCPSocket*>>& TCPSocket::sockets_by_tuple()
|
||||||
{
|
{
|
||||||
return *s_socket_tuples;
|
return *s_socket_tuples;
|
||||||
}
|
}
|
||||||
|
@ -512,9 +512,9 @@ KResult TCPSocket::close()
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Singleton<ProtectedValue<TCPSocket::RetransmitList>> s_sockets_for_retransmit;
|
static Singleton<MutexProtected<TCPSocket::RetransmitList>> s_sockets_for_retransmit;
|
||||||
|
|
||||||
ProtectedValue<TCPSocket::RetransmitList>& TCPSocket::sockets_for_retransmit()
|
MutexProtected<TCPSocket::RetransmitList>& TCPSocket::sockets_for_retransmit()
|
||||||
{
|
{
|
||||||
return *s_sockets_for_retransmit;
|
return *s_sockets_for_retransmit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <AK/SinglyLinkedList.h>
|
#include <AK/SinglyLinkedList.h>
|
||||||
#include <AK/WeakPtr.h>
|
#include <AK/WeakPtr.h>
|
||||||
#include <Kernel/KResult.h>
|
#include <Kernel/KResult.h>
|
||||||
#include <Kernel/Locking/ProtectedValue.h>
|
#include <Kernel/Locking/MutexProtected.h>
|
||||||
#include <Kernel/Net/IPv4Socket.h>
|
#include <Kernel/Net/IPv4Socket.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
@ -142,10 +142,10 @@ public:
|
||||||
|
|
||||||
bool should_delay_next_ack() const;
|
bool should_delay_next_ack() const;
|
||||||
|
|
||||||
static ProtectedValue<HashMap<IPv4SocketTuple, TCPSocket*>>& sockets_by_tuple();
|
static MutexProtected<HashMap<IPv4SocketTuple, TCPSocket*>>& sockets_by_tuple();
|
||||||
static RefPtr<TCPSocket> from_tuple(const IPv4SocketTuple& tuple);
|
static RefPtr<TCPSocket> from_tuple(const IPv4SocketTuple& tuple);
|
||||||
|
|
||||||
static ProtectedValue<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>& closing_sockets();
|
static MutexProtected<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>& closing_sockets();
|
||||||
|
|
||||||
RefPtr<TCPSocket> create_client(const IPv4Address& local_address, u16 local_port, const IPv4Address& peer_address, u16 peer_port);
|
RefPtr<TCPSocket> create_client(const IPv4Address& local_address, u16 local_port, const IPv4Address& peer_address, u16 peer_port);
|
||||||
void set_originator(TCPSocket& originator) { m_originator = originator; }
|
void set_originator(TCPSocket& originator) { m_originator = originator; }
|
||||||
|
@ -207,7 +207,7 @@ private:
|
||||||
size_t size { 0 };
|
size_t size { 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
ProtectedValue<UnackedPackets> m_unacked_packets;
|
MutexProtected<UnackedPackets> m_unacked_packets;
|
||||||
|
|
||||||
u32 m_duplicate_acks { 0 };
|
u32 m_duplicate_acks { 0 };
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using RetransmitList = IntrusiveList<TCPSocket, RawPtr<TCPSocket>, &TCPSocket::m_retransmit_list_node>;
|
using RetransmitList = IntrusiveList<TCPSocket, RawPtr<TCPSocket>, &TCPSocket::m_retransmit_list_node>;
|
||||||
static ProtectedValue<TCPSocket::RetransmitList>& sockets_for_retransmit();
|
static MutexProtected<TCPSocket::RetransmitList>& sockets_for_retransmit();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,9 @@ void UDPSocket::for_each(Function<void(const UDPSocket&)> callback)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static Singleton<ProtectedValue<HashMap<u16, UDPSocket*>>> s_map;
|
static Singleton<MutexProtected<HashMap<u16, UDPSocket*>>> s_map;
|
||||||
|
|
||||||
ProtectedValue<HashMap<u16, UDPSocket*>>& UDPSocket::sockets_by_port()
|
MutexProtected<HashMap<u16, UDPSocket*>>& UDPSocket::sockets_by_port()
|
||||||
{
|
{
|
||||||
return *s_map;
|
return *s_map;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Kernel/KResult.h>
|
#include <Kernel/KResult.h>
|
||||||
#include <Kernel/Locking/ProtectedValue.h>
|
#include <Kernel/Locking/MutexProtected.h>
|
||||||
#include <Kernel/Net/IPv4Socket.h>
|
#include <Kernel/Net/IPv4Socket.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
@ -23,7 +23,7 @@ public:
|
||||||
private:
|
private:
|
||||||
explicit UDPSocket(int protocol, NonnullOwnPtr<DoubleBuffer> receive_buffer);
|
explicit UDPSocket(int protocol, NonnullOwnPtr<DoubleBuffer> receive_buffer);
|
||||||
virtual StringView class_name() const override { return "UDPSocket"; }
|
virtual StringView class_name() const override { return "UDPSocket"; }
|
||||||
static ProtectedValue<HashMap<u16, UDPSocket*>>& sockets_by_port();
|
static MutexProtected<HashMap<u16, UDPSocket*>>& sockets_by_port();
|
||||||
|
|
||||||
virtual KResultOr<size_t> protocol_receive(ReadonlyBytes raw_ipv4_packet, UserOrKernelBuffer& buffer, size_t buffer_size, int flags) override;
|
virtual KResultOr<size_t> protocol_receive(ReadonlyBytes raw_ipv4_packet, UserOrKernelBuffer& buffer, size_t buffer_size, int flags) override;
|
||||||
virtual KResultOr<size_t> protocol_send(const UserOrKernelBuffer&, size_t) override;
|
virtual KResultOr<size_t> protocol_send(const UserOrKernelBuffer&, size_t) override;
|
||||||
|
|
|
@ -44,18 +44,18 @@ static void create_signal_trampoline();
|
||||||
|
|
||||||
RecursiveSpinLock g_profiling_lock;
|
RecursiveSpinLock g_profiling_lock;
|
||||||
static Atomic<pid_t> next_pid;
|
static Atomic<pid_t> next_pid;
|
||||||
static Singleton<ProtectedValue<Process::List>> s_processes;
|
static Singleton<MutexProtected<Process::List>> s_processes;
|
||||||
READONLY_AFTER_INIT HashMap<String, OwnPtr<Module>>* g_modules;
|
READONLY_AFTER_INIT HashMap<String, OwnPtr<Module>>* g_modules;
|
||||||
READONLY_AFTER_INIT Memory::Region* g_signal_trampoline_region;
|
READONLY_AFTER_INIT Memory::Region* g_signal_trampoline_region;
|
||||||
|
|
||||||
static Singleton<ProtectedValue<String>> s_hostname;
|
static Singleton<MutexProtected<String>> s_hostname;
|
||||||
|
|
||||||
ProtectedValue<String>& hostname()
|
MutexProtected<String>& hostname()
|
||||||
{
|
{
|
||||||
return *s_hostname;
|
return *s_hostname;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProtectedValue<Process::List>& processes()
|
MutexProtected<Process::List>& processes()
|
||||||
{
|
{
|
||||||
return *s_processes;
|
return *s_processes;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include <Kernel/Forward.h>
|
#include <Kernel/Forward.h>
|
||||||
#include <Kernel/FutexQueue.h>
|
#include <Kernel/FutexQueue.h>
|
||||||
#include <Kernel/Locking/Mutex.h>
|
#include <Kernel/Locking/Mutex.h>
|
||||||
#include <Kernel/Locking/ProtectedValue.h>
|
#include <Kernel/Locking/MutexProtected.h>
|
||||||
#include <Kernel/Memory/AddressSpace.h>
|
#include <Kernel/Memory/AddressSpace.h>
|
||||||
#include <Kernel/PerformanceEventBuffer.h>
|
#include <Kernel/PerformanceEventBuffer.h>
|
||||||
#include <Kernel/ProcessExposed.h>
|
#include <Kernel/ProcessExposed.h>
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
ProtectedValue<String>& hostname();
|
MutexProtected<String>& hostname();
|
||||||
Time kgettimeofday();
|
Time kgettimeofday();
|
||||||
|
|
||||||
#define ENUMERATE_PLEDGE_PROMISES \
|
#define ENUMERATE_PLEDGE_PROMISES \
|
||||||
|
@ -814,7 +814,7 @@ static_assert(sizeof(Process) == (PAGE_SIZE * 2));
|
||||||
|
|
||||||
extern RecursiveSpinLock g_profiling_lock;
|
extern RecursiveSpinLock g_profiling_lock;
|
||||||
|
|
||||||
ProtectedValue<Process::List>& processes();
|
MutexProtected<Process::List>& processes();
|
||||||
|
|
||||||
template<IteratorFunction<Process&> Callback>
|
template<IteratorFunction<Process&> Callback>
|
||||||
inline void Process::for_each(Callback callback)
|
inline void Process::for_each(Callback callback)
|
||||||
|
|
|
@ -44,7 +44,7 @@ private:
|
||||||
virtual StringView class_name() const override { return "PTYMultiplexer"; }
|
virtual StringView class_name() const override { return "PTYMultiplexer"; }
|
||||||
|
|
||||||
static constexpr size_t max_pty_pairs = 64;
|
static constexpr size_t max_pty_pairs = 64;
|
||||||
ProtectedValue<Vector<unsigned, max_pty_pairs>> m_freelist;
|
MutexProtected<Vector<unsigned, max_pty_pairs>> m_freelist;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue