diff options
author | Andreas Kling <kling@serenityos.org> | 2023-04-02 21:57:12 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-04-04 10:33:42 +0200 |
commit | 83b409083b661ea1b326c3ea9b49f1f38842202e (patch) | |
tree | 2ef66fd2fa2eb05a83f981137a24c63a5f34d700 /Kernel/ProcessGroup.cpp | |
parent | ed1253ab900cf8aec5dc57fb4d5311f22cc5ce9f (diff) | |
download | serenity-83b409083b661ea1b326c3ea9b49f1f38842202e.zip |
Kernel: Stop using *LockRefPtr for ProcessGroup
Had to wrap Process::m_pg in a SpinlockProtected for this to be safe.
Diffstat (limited to 'Kernel/ProcessGroup.cpp')
-rw-r--r-- | Kernel/ProcessGroup.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Kernel/ProcessGroup.cpp b/Kernel/ProcessGroup.cpp index f86b7c1473..be7b389663 100644 --- a/Kernel/ProcessGroup.cpp +++ b/Kernel/ProcessGroup.cpp @@ -24,31 +24,31 @@ ProcessGroup::~ProcessGroup() }); } -ErrorOr<NonnullLockRefPtr<ProcessGroup>> ProcessGroup::try_create(ProcessGroupID pgid) +ErrorOr<NonnullRefPtr<ProcessGroup>> ProcessGroup::create(ProcessGroupID pgid) { - auto process_group = TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) ProcessGroup(pgid))); + auto process_group = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) ProcessGroup(pgid))); process_groups().with([&](auto& groups) { groups.prepend(*process_group); }); return process_group; } -ErrorOr<NonnullLockRefPtr<ProcessGroup>> ProcessGroup::try_find_or_create(ProcessGroupID pgid) +ErrorOr<NonnullRefPtr<ProcessGroup>> ProcessGroup::find_or_create(ProcessGroupID pgid) { - return process_groups().with([&](auto& groups) -> ErrorOr<NonnullLockRefPtr<ProcessGroup>> { + return process_groups().with([&](auto& groups) -> ErrorOr<NonnullRefPtr<ProcessGroup>> { for (auto& group : groups) { if (group.pgid() == pgid) return group; } - auto process_group = TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) ProcessGroup(pgid))); + auto process_group = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) ProcessGroup(pgid))); groups.prepend(*process_group); return process_group; }); } -LockRefPtr<ProcessGroup> ProcessGroup::from_pgid(ProcessGroupID pgid) +RefPtr<ProcessGroup> ProcessGroup::from_pgid(ProcessGroupID pgid) { - return process_groups().with([&](auto& groups) -> LockRefPtr<ProcessGroup> { + return process_groups().with([&](auto& groups) -> RefPtr<ProcessGroup> { for (auto& group : groups) { if (group.pgid() == pgid) return &group; |