mirror of
https://github.com/RGBCube/serenity
synced 2025-05-15 09:34:59 +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
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/Singleton.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <Kernel/Devices/BlockDevice.h>
|
||||
#include <Kernel/FileSystem/Custody.h>
|
||||
|
@ -40,13 +41,17 @@
|
|||
|
||||
namespace Kernel {
|
||||
|
||||
static VFS* s_the;
|
||||
static AK::Singleton<VFS> s_the;
|
||||
static constexpr int symlink_recursion_limit { 5 }; // FIXME: increase?
|
||||
static constexpr int root_mount_flags = MS_NODEV | MS_NOSUID | MS_RDONLY;
|
||||
|
||||
void VFS::initialize()
|
||||
{
|
||||
s_the.ensure_instance();
|
||||
}
|
||||
|
||||
VFS& VFS::the()
|
||||
{
|
||||
ASSERT(s_the);
|
||||
return *s_the;
|
||||
}
|
||||
|
||||
|
@ -55,7 +60,6 @@ VFS::VFS()
|
|||
#ifdef VFS_DEBUG
|
||||
klog() << "VFS: Constructing VFS";
|
||||
#endif
|
||||
s_the = this;
|
||||
}
|
||||
|
||||
VFS::~VFS()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue