[kernel] Fix threads and procs never deleting
A check was added in scheduler::prune() which defers deleting threads and processes if they're the current ones. However, they were still getting removed from the block list, so they were being leaked.
This commit is contained in:
@@ -238,16 +238,22 @@ void scheduler::prune(uint64_t now)
|
|||||||
if (!exited && !ready)
|
if (!exited && !ready)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
m_blocked.remove(remove);
|
|
||||||
|
|
||||||
if (exited) {
|
if (exited) {
|
||||||
|
// If the current thread has exited, wait until the next call
|
||||||
|
// to prune() to delete it, because we may be deleting our current
|
||||||
|
// page tables
|
||||||
|
if (current) continue;
|
||||||
|
|
||||||
|
m_blocked.remove(remove);
|
||||||
process &p = th->parent();
|
process &p = th->parent();
|
||||||
|
|
||||||
// If the current thread has exited, wait until the next call
|
// thread_exited deletes the thread, and returns true if the process
|
||||||
// to prune() to delete it.
|
// should also now be deleted
|
||||||
if(!current && p.thread_exited(th))
|
if(!current && p.thread_exited(th))
|
||||||
delete &p;
|
delete &p;
|
||||||
} else {
|
} else {
|
||||||
|
m_blocked.remove(remove);
|
||||||
log::debug(logs::task, "Prune: readying unblocked thread %llx", th->koid());
|
log::debug(logs::task, "Prune: readying unblocked thread %llx", th->koid());
|
||||||
m_runlists[remove->priority].push_back(remove);
|
m_runlists[remove->priority].push_back(remove);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user