1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:57:35 +00:00

Kernel: Make self-contained locking smart pointers their own classes

Until now, our kernel has reimplemented a number of AK classes to
provide automatic internal locking:

- RefPtr
- NonnullRefPtr
- WeakPtr
- Weakable

This patch renames the Kernel classes so that they can coexist with
the original AK classes:

- RefPtr => LockRefPtr
- NonnullRefPtr => NonnullLockRefPtr
- WeakPtr => LockWeakPtr
- Weakable => LockWeakable

The goal here is to eventually get rid of the Lock* classes in favor of
using external locking.
This commit is contained in:
Andreas Kling 2022-08-19 20:53:40 +02:00
parent e475263113
commit 11eee67b85
360 changed files with 1703 additions and 1672 deletions

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/IntrusiveList.h>
#include <AK/NonnullRefPtr.h>
#include <Kernel/Library/NonnullLockRefPtr.h>
#include <Kernel/Memory/ScopedAddressSpaceSwitcher.h>
#include <Kernel/Process.h>
#include <Kernel/Thread.h>
@ -58,7 +58,7 @@ public:
virtual StringView name() const = 0;
virtual void start() = 0;
void add_sub_request(NonnullRefPtr<AsyncDeviceRequest>);
void add_sub_request(NonnullLockRefPtr<AsyncDeviceRequest>);
[[nodiscard]] RequestWaitResult wait(Time* = nullptr);
@ -142,14 +142,14 @@ private:
AsyncDeviceRequest* m_parent_request { nullptr };
RequestResult m_result { Pending };
IntrusiveListNode<AsyncDeviceRequest, RefPtr<AsyncDeviceRequest>> m_list_node;
IntrusiveListNode<AsyncDeviceRequest, LockRefPtr<AsyncDeviceRequest>> m_list_node;
using AsyncDeviceSubRequestList = IntrusiveList<&AsyncDeviceRequest::m_list_node>;
AsyncDeviceSubRequestList m_sub_requests_pending;
AsyncDeviceSubRequestList m_sub_requests_complete;
WaitQueue m_queue;
NonnullRefPtr<Process> m_process;
NonnullLockRefPtr<Process> m_process;
void* m_private { nullptr };
mutable Spinlock m_lock { LockRank::None };
};