1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:28:12 +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

@ -40,7 +40,7 @@ ErrorOr<NonnullOwnPtr<DoubleBuffer>> IPv4Socket::try_create_receive_buffer()
return DoubleBuffer::try_create("IPv4Socket: Receive buffer"sv, 256 * KiB);
}
ErrorOr<NonnullLockRefPtr<Socket>> IPv4Socket::create(int type, int protocol)
ErrorOr<NonnullRefPtr<Socket>> IPv4Socket::create(int type, int protocol)
{
auto receive_buffer = TRY(IPv4Socket::try_create_receive_buffer());
@ -49,7 +49,7 @@ ErrorOr<NonnullLockRefPtr<Socket>> IPv4Socket::create(int type, int protocol)
if (type == SOCK_DGRAM)
return TRY(UDPSocket::try_create(protocol, move(receive_buffer)));
if (type == SOCK_RAW) {
auto raw_socket = adopt_lock_ref_if_nonnull(new (nothrow) IPv4Socket(type, protocol, move(receive_buffer), {}));
auto raw_socket = adopt_ref_if_nonnull(new (nothrow) IPv4Socket(type, protocol, move(receive_buffer), {}));
if (raw_socket)
return raw_socket.release_nonnull();
return ENOMEM;