summaryrefslogtreecommitdiff
path: root/Kernel/TTY
diff options
context:
space:
mode:
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