diff options
author | Tom <tomut@yahoo.com> | 2020-08-24 19:35:19 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-25 09:48:48 +0200 |
commit | d89582880ed81c38df67687eadfc0764b6ce5ddd (patch) | |
tree | 3ff52c4e8808c5167ee37d5bf0a6669e9a18dfb4 /Kernel/TTY/PTYMultiplexer.cpp | |
parent | ba6e4fb77f00587d2bd57865a00b1a4526684741 (diff) | |
download | serenity-d89582880ed81c38df67687eadfc0764b6ce5ddd.zip |
Kernel: Switch singletons to use new Singleton class
MemoryManager cannot use the Singleton class because
MemoryManager::initialize is called before the global constructors
are run. That caused the Singleton to be re-initialized, causing
it to create another MemoryManager instance.
Fixes #3226
Diffstat (limited to 'Kernel/TTY/PTYMultiplexer.cpp')
-rw-r--r-- | Kernel/TTY/PTYMultiplexer.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Kernel/TTY/PTYMultiplexer.cpp b/Kernel/TTY/PTYMultiplexer.cpp index ccc0678e43..e4b7394a9b 100644 --- a/Kernel/TTY/PTYMultiplexer.cpp +++ b/Kernel/TTY/PTYMultiplexer.cpp @@ -26,6 +26,7 @@ #include "PTYMultiplexer.h" #include "MasterPTY.h" +#include <AK/Singleton.h> #include <Kernel/FileSystem/FileDescription.h> #include <Kernel/Process.h> #include <LibC/errno_numbers.h> @@ -35,18 +36,16 @@ namespace Kernel { static const unsigned s_max_pty_pairs = 8; -static PTYMultiplexer* s_the; +static AK::Singleton<PTYMultiplexer> s_the; 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); |