diff options
author | Tom <tomut@yahoo.com> | 2020-08-20 09:36:06 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-21 11:47:35 +0200 |
commit | f48feae0b2a300992479abf0b2ded85e45ac6045 (patch) | |
tree | d0b01169a60261135ee15a8d4a6abd01785a7bec /Kernel/Net/UDPSocket.cpp | |
parent | 527c8047fe0a08ade2e17fd096ad9b4ebc103ec5 (diff) | |
download | serenity-f48feae0b2a300992479abf0b2ded85e45ac6045.zip |
Kernel: Switch singletons to use new Singleton class
Fixes #3226
Diffstat (limited to 'Kernel/Net/UDPSocket.cpp')
-rw-r--r-- | Kernel/Net/UDPSocket.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/Net/UDPSocket.cpp b/Kernel/Net/UDPSocket.cpp index 65091a37c1..ad57696675 100644 --- a/Kernel/Net/UDPSocket.cpp +++ b/Kernel/Net/UDPSocket.cpp @@ -31,6 +31,7 @@ #include <Kernel/Net/UDPSocket.h> #include <Kernel/Process.h> #include <Kernel/Random.h> +#include <Kernel/Singleton.h> namespace Kernel { @@ -41,11 +42,10 @@ void UDPSocket::for_each(Function<void(const UDPSocket&)> callback) callback(*it.value); } +static auto s_map = make_singleton<Lockable<HashMap<u16, UDPSocket*>>>(); + Lockable<HashMap<u16, UDPSocket*>>& UDPSocket::sockets_by_port() { - static Lockable<HashMap<u16, UDPSocket*>>* s_map; - if (!s_map) - s_map = new Lockable<HashMap<u16, UDPSocket*>>; return *s_map; } |