mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 02:38:13 +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:
parent
5331d243c6
commit
728c3fbd14
23 changed files with 143 additions and 102 deletions
|
@ -449,9 +449,9 @@ public:
|
|||
u32 m_ticks_in_user_for_dead_children { 0 };
|
||||
u32 m_ticks_in_kernel_for_dead_children { 0 };
|
||||
|
||||
NonnullLockRefPtr<Custody> current_directory();
|
||||
Custody* executable() { return m_executable.ptr(); }
|
||||
Custody const* executable() const { return m_executable.ptr(); }
|
||||
NonnullRefPtr<Custody> current_directory();
|
||||
RefPtr<Custody> executable();
|
||||
RefPtr<Custody const> executable() const;
|
||||
|
||||
static constexpr size_t max_arguments_size = Thread::default_userspace_stack_size / 8;
|
||||
static constexpr size_t max_environment_size = Thread::default_userspace_stack_size / 8;
|
||||
|
@ -556,8 +556,8 @@ private:
|
|||
bool add_thread(Thread&);
|
||||
bool remove_thread(Thread&);
|
||||
|
||||
Process(NonnullOwnPtr<KString> name, NonnullRefPtr<Credentials>, ProcessID ppid, bool is_kernel_process, LockRefPtr<Custody> current_directory, LockRefPtr<Custody> executable, TTY* tty, UnveilNode unveil_tree);
|
||||
static ErrorOr<NonnullLockRefPtr<Process>> try_create(LockRefPtr<Thread>& first_thread, NonnullOwnPtr<KString> name, UserID, GroupID, ProcessID ppid, bool is_kernel_process, LockRefPtr<Custody> current_directory = nullptr, LockRefPtr<Custody> executable = nullptr, TTY* = nullptr, Process* fork_parent = nullptr);
|
||||
Process(NonnullOwnPtr<KString> name, NonnullRefPtr<Credentials>, ProcessID ppid, bool is_kernel_process, RefPtr<Custody> current_directory, RefPtr<Custody> executable, TTY* tty, UnveilNode unveil_tree);
|
||||
static ErrorOr<NonnullLockRefPtr<Process>> try_create(LockRefPtr<Thread>& first_thread, NonnullOwnPtr<KString> name, UserID, GroupID, ProcessID ppid, bool is_kernel_process, RefPtr<Custody> current_directory = nullptr, RefPtr<Custody> executable = nullptr, TTY* = nullptr, Process* fork_parent = nullptr);
|
||||
ErrorOr<void> attach_resources(NonnullOwnPtr<Memory::AddressSpace>&&, LockRefPtr<Thread>& first_thread, Process* fork_parent);
|
||||
static ProcessID allocate_pid();
|
||||
|
||||
|
@ -824,9 +824,9 @@ private:
|
|||
Atomic<bool, AK::MemoryOrder::memory_order_relaxed> m_is_stopped { false };
|
||||
bool m_should_generate_coredump { false };
|
||||
|
||||
LockRefPtr<Custody> m_executable;
|
||||
SpinlockProtected<RefPtr<Custody>> m_executable;
|
||||
|
||||
SpinlockProtected<LockRefPtr<Custody>> m_current_directory;
|
||||
SpinlockProtected<RefPtr<Custody>> m_current_directory;
|
||||
|
||||
NonnullOwnPtrVector<KString> m_arguments;
|
||||
NonnullOwnPtrVector<KString> m_environment;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue