1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

Revert "Kernel: Move Singleton class to AK"

This reverts commit f0906250a1.
This commit is contained in:
Andreas Kling 2020-08-22 16:34:49 +02:00
parent b0a24a83be
commit 8925ad3fa0
31 changed files with 71 additions and 87 deletions

View file

@ -24,7 +24,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Singleton.h>
#include <AK/Time.h>
#include <Kernel/Devices/RandomDevice.h>
#include <Kernel/FileSystem/FileDescription.h>
@ -34,6 +33,7 @@
#include <Kernel/Net/TCPSocket.h>
#include <Kernel/Process.h>
#include <Kernel/Random.h>
#include <Kernel/Singleton.h>
//#define TCP_SOCKET_DEBUG
@ -63,18 +63,19 @@ void TCPSocket::set_state(State new_state)
}
}
static auto s_socket_closing = AK::make_singleton<Lockable<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>>();
Lockable<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>& TCPSocket::closing_sockets()
{
return *s_socket_closing;
static Lockable<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>* s_map;
if (!s_map)
s_map = new Lockable<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>;
return *s_map;
}
static auto s_socket_tuples = AK::make_singleton<Lockable<HashMap<IPv4SocketTuple, TCPSocket*>>>();
static auto s_map = make_singleton<Lockable<HashMap<IPv4SocketTuple, TCPSocket*>>>();
Lockable<HashMap<IPv4SocketTuple, TCPSocket*>>& TCPSocket::sockets_by_tuple()
{
return *s_socket_tuples;
return *s_map;
}
RefPtr<TCPSocket> TCPSocket::from_tuple(const IPv4SocketTuple& tuple)