1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:27:34 +00:00

Kernel: Use RefPtr instead of LockRefPtr for Custody

By protecting all the RefPtr<Custody> objects that may be accessed from
multiple threads at the same time (with spinlocks), we remove the need
for using LockRefPtr<Custody> (which is basically a RefPtr with a
built-in spinlock.)
This commit is contained in:
Andreas Kling 2022-08-21 01:04:35 +02:00
parent 5331d243c6
commit 728c3fbd14
23 changed files with 143 additions and 102 deletions

View file

@ -6,6 +6,7 @@
#pragma once
#include <AK/RefPtr.h>
#include <Kernel/FileSystem/Custody.h>
#include <Kernel/Forward.h>
#include <Kernel/Library/NonnullLockRefPtr.h>
@ -17,8 +18,8 @@ public:
Mount(FileSystem&, Custody* host_custody, int flags);
Mount(Inode& source, Custody& host_custody, int flags);
Inode const* host() const;
Inode* host();
LockRefPtr<Inode const> host() const;
LockRefPtr<Inode> host();
Inode const& guest() const { return *m_guest; }
Inode& guest() { return *m_guest; }
@ -34,7 +35,7 @@ public:
private:
NonnullLockRefPtr<Inode> m_guest;
NonnullLockRefPtr<FileSystem> m_guest_fs;
LockRefPtr<Custody> m_host_custody;
SpinlockProtected<RefPtr<Custody>> m_host_custody;
int m_flags;
};