mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-30 22:54:35 +03:00
a6a439243f
This step would ideally not have been necessary (increases amount of refactoring and templates necessary, which in turn increases build times), but it gives us a couple of nice properties: - SpinlockProtected inside Singleton (a very common combination) can now obtain any lock rank just via the template parameter. It was not previously possible to do this with SingletonInstanceCreator magic. - SpinlockProtected's lock rank is now mandatory; this is the majority of cases and allows us to see where we're still missing proper ranks. - The type already informs us what lock rank a lock has, which aids code readability and (possibly, if gdb cooperates) lock mismatch debugging. - The rank of a lock can no longer be dynamic, which is not something we wanted in the first place (or made use of). Locks randomly changing their rank sounds like a disaster waiting to happen. - In some places, we might be able to statically check that locks are taken in the right order (with the right lock rank checking implementation) as rank information is fully statically known. This refactoring even more exposes the fact that Mutex has no lock rank capabilites, which is not fixed here.
108 lines
2.1 KiB
C++
108 lines
2.1 KiB
C++
/*
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/DistinctNumeric.h>
|
|
#include <Kernel/API/POSIX/sys/types.h>
|
|
|
|
namespace Kernel {
|
|
|
|
enum class LockRank;
|
|
|
|
class BlockDevice;
|
|
class CharacterDevice;
|
|
class Coredump;
|
|
class Credentials;
|
|
class Custody;
|
|
class Device;
|
|
class DiskCache;
|
|
class DoubleBuffer;
|
|
class File;
|
|
class FATInode;
|
|
class OpenFileDescription;
|
|
class DisplayConnector;
|
|
class FileSystem;
|
|
class FutexQueue;
|
|
class IPv4Socket;
|
|
class Inode;
|
|
class InodeIdentifier;
|
|
class InodeWatcher;
|
|
class Jail;
|
|
class KBuffer;
|
|
class KString;
|
|
class LocalSocket;
|
|
class Mutex;
|
|
class MasterPTY;
|
|
class Mount;
|
|
class PerformanceEventBuffer;
|
|
class ProcFS;
|
|
class ProcFSDirectoryInode;
|
|
class ProcFSExposedComponent;
|
|
class ProcFSExposedDirectory;
|
|
class ProcFSInode;
|
|
class ProcFSProcessInformation;
|
|
class ProcFSRootDirectory;
|
|
class ProcFSSystemBoolean;
|
|
class ProcFSSystemDirectory;
|
|
class Process;
|
|
class ProcessGroup;
|
|
template<LockRank Rank>
|
|
class RecursiveSpinlock;
|
|
class Scheduler;
|
|
class Socket;
|
|
class SysFS;
|
|
class SysFSDirectory;
|
|
class SysFSRootDirectory;
|
|
class SysFSBusDirectory;
|
|
class SysFSDevicesDirectory;
|
|
class SysFSDirectoryInode;
|
|
class SysFSInode;
|
|
class TCPSocket;
|
|
class TTY;
|
|
class Thread;
|
|
class ThreadTracer;
|
|
class TmpFSInode;
|
|
class UDPSocket;
|
|
class UserOrKernelBuffer;
|
|
class VirtualFileSystem;
|
|
class WaitQueue;
|
|
class WorkQueue;
|
|
|
|
namespace Memory {
|
|
class AddressSpace;
|
|
class AnonymousVMObject;
|
|
class InodeVMObject;
|
|
class MappedROM;
|
|
class MemoryManager;
|
|
class PageDirectory;
|
|
class PhysicalPage;
|
|
class PhysicalRegion;
|
|
class PrivateInodeVMObject;
|
|
class Region;
|
|
class SharedInodeVMObject;
|
|
class VMObject;
|
|
class VirtualRange;
|
|
}
|
|
|
|
template<LockRank Rank>
|
|
class Spinlock;
|
|
template<typename LockType>
|
|
class SpinlockLocker;
|
|
|
|
struct InodeMetadata;
|
|
struct TrapFrame;
|
|
|
|
AK_TYPEDEF_DISTINCT_ORDERED_ID(pid_t, ProcessID);
|
|
AK_TYPEDEF_DISTINCT_ORDERED_ID(pid_t, ThreadID);
|
|
AK_TYPEDEF_DISTINCT_ORDERED_ID(pid_t, SessionID);
|
|
AK_TYPEDEF_DISTINCT_ORDERED_ID(pid_t, ProcessGroupID);
|
|
|
|
AK_TYPEDEF_DISTINCT_ORDERED_ID(uid_t, UserID);
|
|
AK_TYPEDEF_DISTINCT_ORDERED_ID(gid_t, GroupID);
|
|
|
|
}
|