mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 00:31:14 +00:00
Kernel: Switch ProcessGroup to IntrusiveList from InlineLinkedList
This commit is contained in:
parent
ce74fce0df
commit
7e691f96e1
Notes:
sideshowbarker
2024-07-18 16:57:43 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/7e691f96e1e Pull-request: https://github.com/SerenityOS/serenity/pull/7728
|
@ -62,7 +62,7 @@ UNMAP_AFTER_INIT void Process::initialize()
|
|||
|
||||
next_pid.store(0, AK::MemoryOrder::memory_order_release);
|
||||
g_processes = new InlineLinkedList<Process>;
|
||||
g_process_groups = new InlineLinkedList<ProcessGroup>;
|
||||
g_process_groups = new ProcessGroup::List();
|
||||
g_hostname = new String("courage");
|
||||
g_hostname_lock = new Lock;
|
||||
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
namespace Kernel {
|
||||
|
||||
RecursiveSpinLock g_process_groups_lock;
|
||||
InlineLinkedList<ProcessGroup>* g_process_groups;
|
||||
ProcessGroup::List* g_process_groups;
|
||||
|
||||
ProcessGroup::~ProcessGroup()
|
||||
{
|
||||
ScopedSpinLock lock(g_process_groups_lock);
|
||||
g_process_groups->remove(this);
|
||||
g_process_groups->remove(*this);
|
||||
}
|
||||
|
||||
RefPtr<ProcessGroup> ProcessGroup::create(ProcessGroupID pgid)
|
||||
|
@ -22,7 +22,7 @@ RefPtr<ProcessGroup> ProcessGroup::create(ProcessGroupID pgid)
|
|||
auto process_group = adopt_ref_if_nonnull(new ProcessGroup(pgid));
|
||||
if (process_group) {
|
||||
ScopedSpinLock lock(g_process_groups_lock);
|
||||
g_process_groups->prepend(process_group);
|
||||
g_process_groups->prepend(*process_group);
|
||||
}
|
||||
|
||||
return process_group;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/InlineLinkedList.h>
|
||||
#include <AK/IntrusiveList.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/Weakable.h>
|
||||
#include <Kernel/Lock.h>
|
||||
|
@ -17,14 +17,11 @@ namespace Kernel {
|
|||
|
||||
class ProcessGroup
|
||||
: public RefCounted<ProcessGroup>
|
||||
, public Weakable<ProcessGroup>
|
||||
, public InlineLinkedListNode<ProcessGroup> {
|
||||
, public Weakable<ProcessGroup> {
|
||||
|
||||
AK_MAKE_NONMOVABLE(ProcessGroup);
|
||||
AK_MAKE_NONCOPYABLE(ProcessGroup);
|
||||
|
||||
friend InlineLinkedListNode<ProcessGroup>;
|
||||
|
||||
public:
|
||||
~ProcessGroup();
|
||||
|
||||
|
@ -40,13 +37,14 @@ private:
|
|||
{
|
||||
}
|
||||
|
||||
ProcessGroup* m_prev { nullptr };
|
||||
ProcessGroup* m_next { nullptr };
|
||||
|
||||
IntrusiveListNode<ProcessGroup> m_list_node;
|
||||
ProcessGroupID m_pgid;
|
||||
|
||||
public:
|
||||
using List = IntrusiveList<ProcessGroup, RawPtr<ProcessGroup>, &ProcessGroup::m_list_node>;
|
||||
};
|
||||
|
||||
extern InlineLinkedList<ProcessGroup>* g_process_groups;
|
||||
extern ProcessGroup::List* g_process_groups;
|
||||
extern RecursiveSpinLock g_process_groups_lock;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue