1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:48:10 +00:00

Kernel: Use RefPtr instead of LockRefPtr for File and subclasses

This was mostly straightforward, as all the storage locations are
guarded by some related mutex.

The use of old-school associated mutexes instead of MutexProtected
is unfortunate, but the process to modernize such code is ongoing.
This commit is contained in:
Andreas Kling 2023-03-10 07:53:02 +01:00
parent 61bb9103c2
commit 03cc45e5a2
20 changed files with 63 additions and 63 deletions

View file

@ -38,9 +38,9 @@ MutexProtected<HashMap<u16, UDPSocket*>>& UDPSocket::sockets_by_port()
return *s_map;
}
LockRefPtr<UDPSocket> UDPSocket::from_port(u16 port)
RefPtr<UDPSocket> UDPSocket::from_port(u16 port)
{
return sockets_by_port().with_shared([&](auto const& table) -> LockRefPtr<UDPSocket> {
return sockets_by_port().with_shared([&](auto const& table) -> RefPtr<UDPSocket> {
auto it = table.find(port);
if (it == table.end())
return {};
@ -60,9 +60,9 @@ UDPSocket::~UDPSocket()
});
}
ErrorOr<NonnullLockRefPtr<UDPSocket>> UDPSocket::try_create(int protocol, NonnullOwnPtr<DoubleBuffer> receive_buffer)
ErrorOr<NonnullRefPtr<UDPSocket>> UDPSocket::try_create(int protocol, NonnullOwnPtr<DoubleBuffer> receive_buffer)
{
return adopt_nonnull_lock_ref_or_enomem(new (nothrow) UDPSocket(protocol, move(receive_buffer)));
return adopt_nonnull_ref_or_enomem(new (nothrow) UDPSocket(protocol, move(receive_buffer)));
}
ErrorOr<size_t> UDPSocket::protocol_size(ReadonlyBytes raw_ipv4_packet)