mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
Kernel/ProcFS: Clean dead processes properly
Now we use WeakPtrs to break Ref-counting cycle. Also, we call the prepare_for_deletion method to ensure deleted objects are ready for deletion. This is necessary to ensure we don't keep dead processes, which would become zombies. In addition to that, add some debug prints to aid debug in the future.
This commit is contained in:
parent
5073bf8e75
commit
3344f91fc4
Notes:
sideshowbarker
2024-07-18 11:08:13 +09:00
Author: https://github.com/supercomputer7
Commit: 3344f91fc4
Pull-request: https://github.com/SerenityOS/serenity/pull/8241
Issue: https://github.com/SerenityOS/serenity/issues/6948
Issue: https://github.com/SerenityOS/serenity/issues/7445
Issue: https://github.com/SerenityOS/serenity/issues/8331
Reviewed-by: https://github.com/IdanHo
Reviewed-by: https://github.com/awesomekling
6 changed files with 103 additions and 43 deletions
|
@ -459,8 +459,12 @@ void Thread::finalize_dying_threads()
|
|||
});
|
||||
}
|
||||
for (auto* thread : dying_threads) {
|
||||
RefPtr<Process> 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();
|
||||
|
||||
dbgln_if(PROCESS_DEBUG, "After finalization, {} has {} refs and its process has {}",
|
||||
*thread, thread->ref_count(), thread->process().ref_count());
|
||||
// This thread will never execute again, drop the running reference
|
||||
// NOTE: This may not necessarily drop the last reference if anything
|
||||
// else is still holding onto this thread!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue