mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 22:48:11 +00:00
Kernel: Rename Lock to Mutex
Let's be explicit about what kind of lock this is meant to be.
This commit is contained in:
parent
a803c4026c
commit
cee9528168
51 changed files with 140 additions and 140 deletions
|
@ -10,7 +10,7 @@
|
|||
#include <AK/SinglyLinkedListWithCount.h>
|
||||
#include <Kernel/DoubleBuffer.h>
|
||||
#include <Kernel/KBuffer.h>
|
||||
#include <Kernel/Lock.h>
|
||||
#include <Kernel/Mutex.h>
|
||||
#include <Kernel/Net/IPv4.h>
|
||||
#include <Kernel/Net/IPv4SocketTuple.h>
|
||||
#include <Kernel/Net/Socket.h>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <AK/HashMap.h>
|
||||
#include <Kernel/DoubleBuffer.h>
|
||||
#include <Kernel/KBuffer.h>
|
||||
#include <Kernel/Lock.h>
|
||||
#include <Kernel/Mutex.h>
|
||||
#include <Kernel/Net/IPv4.h>
|
||||
#include <Kernel/Net/Socket.h>
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ static Lockable<LocalSocket::List>& all_sockets()
|
|||
|
||||
void LocalSocket::for_each(Function<void(const LocalSocket&)> callback)
|
||||
{
|
||||
Locker locker(all_sockets().lock(), Lock::Mode::Shared);
|
||||
Locker locker(all_sockets().lock(), Mutex::Mode::Shared);
|
||||
for (auto& socket : all_sockets().resource())
|
||||
callback(socket);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <Kernel/Debug.h>
|
||||
#include <Kernel/Lock.h>
|
||||
#include <Kernel/Mutex.h>
|
||||
#include <Kernel/Net/ARP.h>
|
||||
#include <Kernel/Net/EtherType.h>
|
||||
#include <Kernel/Net/EthernetFrameHeader.h>
|
||||
|
@ -224,7 +224,7 @@ void handle_icmp(const EthernetFrameHeader& eth, const IPv4Packet& ipv4_packet,
|
|||
{
|
||||
NonnullRefPtrVector<IPv4Socket> icmp_sockets;
|
||||
{
|
||||
Locker locker(IPv4Socket::all_sockets().lock(), Lock::Mode::Shared);
|
||||
Locker locker(IPv4Socket::all_sockets().lock(), Mutex::Mode::Shared);
|
||||
for (auto* socket : IPv4Socket::all_sockets().resource()) {
|
||||
if (socket->protocol() != (unsigned)IPv4Protocol::ICMP)
|
||||
continue;
|
||||
|
|
|
@ -40,7 +40,7 @@ private:
|
|||
|
||||
NonnullRefPtrVector<NetworkAdapter> m_adapters;
|
||||
RefPtr<NetworkAdapter> m_loopback_adapter;
|
||||
mutable Lock m_lock { "Networking" };
|
||||
mutable Mutex m_lock { "Networking" };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <AK/Time.h>
|
||||
#include <Kernel/FileSystem/File.h>
|
||||
#include <Kernel/KResult.h>
|
||||
#include <Kernel/Lock.h>
|
||||
#include <Kernel/Mutex.h>
|
||||
#include <Kernel/Net/NetworkAdapter.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
|
||||
|
@ -99,7 +99,7 @@ public:
|
|||
gid_t acceptor_gid() const { return m_acceptor.gid; }
|
||||
const RefPtr<NetworkAdapter> bound_interface() const { return m_bound_interface; }
|
||||
|
||||
Lock& lock() { return m_lock; }
|
||||
Mutex& lock() { return m_lock; }
|
||||
|
||||
// ^File
|
||||
virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override final;
|
||||
|
@ -137,7 +137,7 @@ protected:
|
|||
private:
|
||||
virtual bool is_socket() const final { return true; }
|
||||
|
||||
Lock m_lock { "Socket" };
|
||||
Mutex m_lock { "Socket" };
|
||||
|
||||
int m_domain { 0 };
|
||||
int m_type { 0 };
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Kernel {
|
|||
|
||||
void TCPSocket::for_each(Function<void(const TCPSocket&)> callback)
|
||||
{
|
||||
Locker locker(sockets_by_tuple().lock(), Lock::Mode::Shared);
|
||||
Locker locker(sockets_by_tuple().lock(), Mutex::Mode::Shared);
|
||||
for (auto& it : sockets_by_tuple().resource())
|
||||
callback(*it.value);
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ Lockable<HashMap<IPv4SocketTuple, TCPSocket*>>& TCPSocket::sockets_by_tuple()
|
|||
|
||||
RefPtr<TCPSocket> TCPSocket::from_tuple(const IPv4SocketTuple& tuple)
|
||||
{
|
||||
Locker locker(sockets_by_tuple().lock(), Lock::Mode::Shared);
|
||||
Locker locker(sockets_by_tuple().lock(), Mutex::Mode::Shared);
|
||||
|
||||
auto exact_match = sockets_by_tuple().resource().get(tuple);
|
||||
if (exact_match.has_value())
|
||||
|
@ -91,7 +91,7 @@ RefPtr<TCPSocket> TCPSocket::create_client(const IPv4Address& new_local_address,
|
|||
auto tuple = IPv4SocketTuple(new_local_address, new_local_port, new_peer_address, new_peer_port);
|
||||
|
||||
{
|
||||
Locker locker(sockets_by_tuple().lock(), Lock::Mode::Shared);
|
||||
Locker locker(sockets_by_tuple().lock(), Mutex::Mode::Shared);
|
||||
if (sockets_by_tuple().resource().contains(tuple))
|
||||
return {};
|
||||
}
|
||||
|
@ -545,7 +545,7 @@ void TCPSocket::retransmit_packets()
|
|||
if (routing_decision.is_zero())
|
||||
return;
|
||||
|
||||
Locker locker(m_not_acked_lock, Lock::Mode::Shared);
|
||||
Locker locker(m_not_acked_lock, Mutex::Mode::Shared);
|
||||
for (auto& packet : m_not_acked) {
|
||||
packet.tx_counter++;
|
||||
|
||||
|
|
|
@ -202,7 +202,7 @@ private:
|
|||
int tx_counter { 0 };
|
||||
};
|
||||
|
||||
mutable Lock m_not_acked_lock { "TCPSocket unacked packets" };
|
||||
mutable Mutex m_not_acked_lock { "TCPSocket unacked packets" };
|
||||
SinglyLinkedList<OutgoingPacket> m_not_acked;
|
||||
size_t m_not_acked_size { 0 };
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Kernel {
|
|||
|
||||
void UDPSocket::for_each(Function<void(const UDPSocket&)> callback)
|
||||
{
|
||||
Locker locker(sockets_by_port().lock(), Lock::Mode::Shared);
|
||||
Locker locker(sockets_by_port().lock(), Mutex::Mode::Shared);
|
||||
for (auto it : sockets_by_port().resource())
|
||||
callback(*it.value);
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ SocketHandle<UDPSocket> UDPSocket::from_port(u16 port)
|
|||
{
|
||||
RefPtr<UDPSocket> socket;
|
||||
{
|
||||
Locker locker(sockets_by_port().lock(), Lock::Mode::Shared);
|
||||
Locker locker(sockets_by_port().lock(), Mutex::Mode::Shared);
|
||||
auto it = sockets_by_port().resource().find(port);
|
||||
if (it == sockets_by_port().resource().end())
|
||||
return {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue