summaryrefslogtreecommitdiff
path: root/Kernel/TTY
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2020-08-20 09:36:06 -0600
committerAndreas Kling <kling@serenityos.org>2020-08-21 11:47:35 +0200
commitf48feae0b2a300992479abf0b2ded85e45ac6045 (patch)
treed0b01169a60261135ee15a8d4a6abd01785a7bec /Kernel/TTY
parent527c8047fe0a08ade2e17fd096ad9b4ebc103ec5 (diff)
downloadserenity-f48feae0b2a300992479abf0b2ded85e45ac6045.zip
Kernel: Switch singletons to use new Singleton class
Fixes #3226
Diffstat (limited to 'Kernel/TTY')
-rw-r--r--Kernel/TTY/PTYMultiplexer.cpp5
-rw-r--r--Kernel/TTY/PTYMultiplexer.h4
2 files changed, 6 insertions, 3 deletions
diff --git a/Kernel/TTY/PTYMultiplexer.cpp b/Kernel/TTY/PTYMultiplexer.cpp
index ccc0678e43..4f8d48806e 100644
--- a/Kernel/TTY/PTYMultiplexer.cpp
+++ b/Kernel/TTY/PTYMultiplexer.cpp
@@ -28,6 +28,7 @@
#include "MasterPTY.h"
#include <Kernel/FileSystem/FileDescription.h>
#include <Kernel/Process.h>
+#include <Kernel/Singleton.h>
#include <LibC/errno_numbers.h>
//#define PTMX_DEBUG
@@ -35,18 +36,16 @@
namespace Kernel {
static const unsigned s_max_pty_pairs = 8;
-static PTYMultiplexer* s_the;
+static auto s_the = make_singleton<PTYMultiplexer>();
PTYMultiplexer& PTYMultiplexer::the()
{
- ASSERT(s_the);
return *s_the;
}
PTYMultiplexer::PTYMultiplexer()
: CharacterDevice(5, 2)
{
- s_the = this;
m_freelist.ensure_capacity(s_max_pty_pairs);
for (int i = s_max_pty_pairs; i > 0; --i)
m_freelist.unchecked_append(i - 1);
diff --git a/Kernel/TTY/PTYMultiplexer.h b/Kernel/TTY/PTYMultiplexer.h
index 15bb4bdc19..17698009c5 100644
--- a/Kernel/TTY/PTYMultiplexer.h
+++ b/Kernel/TTY/PTYMultiplexer.h
@@ -40,6 +40,10 @@ public:
PTYMultiplexer();
virtual ~PTYMultiplexer() override;
+ static void initialize()
+ {
+ the();
+ }
static PTYMultiplexer& the();
// ^CharacterDevice