mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:58:11 +00:00
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
This commit is contained in:
parent
ba6e4fb77f
commit
d89582880e
46 changed files with 221 additions and 170 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue