mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 03:12:44 +00:00 
			
		
		
		
	 5a0cdb15b0
			
		
	
	
		5a0cdb15b0
		
	
	
	
	
		
			
			This makes the user-facing type only take the node member pointer, and lets the compiler figure out the other needed types from that.
		
			
				
	
	
		
			48 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2020, the SerenityOS developers.
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/IntrusiveList.h>
 | |
| #include <AK/RefCounted.h>
 | |
| #include <AK/Weakable.h>
 | |
| #include <Kernel/Locking/SpinlockProtected.h>
 | |
| #include <Kernel/UnixTypes.h>
 | |
| 
 | |
| namespace Kernel {
 | |
| 
 | |
| class ProcessGroup
 | |
|     : public RefCounted<ProcessGroup>
 | |
|     , public Weakable<ProcessGroup> {
 | |
| 
 | |
|     AK_MAKE_NONMOVABLE(ProcessGroup);
 | |
|     AK_MAKE_NONCOPYABLE(ProcessGroup);
 | |
| 
 | |
| public:
 | |
|     ~ProcessGroup();
 | |
| 
 | |
|     static KResultOr<NonnullRefPtr<ProcessGroup>> try_create(ProcessGroupID);
 | |
|     static KResultOr<NonnullRefPtr<ProcessGroup>> try_find_or_create(ProcessGroupID);
 | |
|     static RefPtr<ProcessGroup> from_pgid(ProcessGroupID);
 | |
| 
 | |
|     const ProcessGroupID& pgid() const { return m_pgid; }
 | |
| 
 | |
| private:
 | |
|     ProcessGroup(ProcessGroupID pgid)
 | |
|         : m_pgid(pgid)
 | |
|     {
 | |
|     }
 | |
| 
 | |
|     IntrusiveListNode<ProcessGroup> m_list_node;
 | |
|     ProcessGroupID m_pgid;
 | |
| 
 | |
| public:
 | |
|     using List = IntrusiveList<&ProcessGroup::m_list_node>;
 | |
| };
 | |
| 
 | |
| SpinlockProtected<ProcessGroup::List>& process_groups();
 | |
| 
 | |
| }
 |