mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 13:45:07 +00:00
Kernel: Stop using *LockRefPtr for Process pointers
The only persistent one of these was Thread::m_process and that never changes after initialization. Make it const to enforce this and switch everything over to RefPtr & NonnullRefPtr.
This commit is contained in:
parent
19084ef743
commit
65438d8a85
11 changed files with 42 additions and 42 deletions
|
@ -39,7 +39,7 @@ SpinlockProtected<Thread::GlobalList, LockRank::None>& Thread::all_instances()
|
|||
return *s_list;
|
||||
}
|
||||
|
||||
ErrorOr<NonnullLockRefPtr<Thread>> Thread::try_create(NonnullLockRefPtr<Process> process)
|
||||
ErrorOr<NonnullLockRefPtr<Thread>> Thread::try_create(NonnullRefPtr<Process> process)
|
||||
{
|
||||
auto kernel_stack_region = TRY(MM.allocate_kernel_region(default_kernel_stack_size, {}, Memory::Region::Access::ReadWrite, AllocationStrategy::AllocateNow));
|
||||
kernel_stack_region->set_stack(true);
|
||||
|
@ -50,7 +50,7 @@ ErrorOr<NonnullLockRefPtr<Thread>> Thread::try_create(NonnullLockRefPtr<Process>
|
|||
return adopt_nonnull_lock_ref_or_enomem(new (nothrow) Thread(move(process), move(kernel_stack_region), move(block_timer), move(name)));
|
||||
}
|
||||
|
||||
Thread::Thread(NonnullLockRefPtr<Process> process, NonnullOwnPtr<Memory::Region> kernel_stack_region, NonnullLockRefPtr<Timer> block_timer, NonnullOwnPtr<KString> name)
|
||||
Thread::Thread(NonnullRefPtr<Process> process, NonnullOwnPtr<Memory::Region> kernel_stack_region, NonnullLockRefPtr<Timer> block_timer, NonnullOwnPtr<KString> name)
|
||||
: m_process(move(process))
|
||||
, m_kernel_stack_region(move(kernel_stack_region))
|
||||
, m_name(move(name))
|
||||
|
@ -596,7 +596,7 @@ void Thread::finalize_dying_threads()
|
|||
});
|
||||
}
|
||||
for (auto* thread : dying_threads) {
|
||||
LockRefPtr<Process> process = thread->process();
|
||||
RefPtr<Process> const process = thread->process();
|
||||
dbgln_if(PROCESS_DEBUG, "Before finalization, {} has {} refs and its process has {}",
|
||||
*thread, thread->ref_count(), thread->process().ref_count());
|
||||
thread->finalize();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue