Move suspension q's cleanup to proc/suspension_q.c
This commit is contained in:
@@ -94,31 +94,7 @@ struct proc* proc_clone (struct proc* proto, uintptr_t vstack_top, uintptr_t ent
|
||||
}
|
||||
|
||||
void proc_cleanup (struct proc* proc) {
|
||||
spin_lock_ctx_t ctxsq, ctxpr;
|
||||
|
||||
spin_lock (&proc->lock, &ctxpr);
|
||||
|
||||
/* clean suspension queue entries */
|
||||
struct list_node_link *sq_link, *sq_link_tmp;
|
||||
list_foreach (proc->sq_entries, sq_link, sq_link_tmp) {
|
||||
struct proc_sq_entry* sq_entry = list_entry (sq_link, struct proc_sq_entry, proc_link);
|
||||
struct proc_suspension_q* sq = sq_entry->sq;
|
||||
|
||||
spin_lock (&sq->lock, &ctxsq);
|
||||
|
||||
/* remove from sq's list */
|
||||
list_remove (sq->proc_list, &sq_entry->sq_link);
|
||||
|
||||
/* remove from proc's list */
|
||||
list_remove (proc->sq_entries, &sq_entry->proc_link);
|
||||
|
||||
spin_unlock (&sq->lock, &ctxsq);
|
||||
|
||||
free (sq_entry);
|
||||
}
|
||||
|
||||
spin_unlock (&proc->lock, &ctxpr);
|
||||
|
||||
proc_sqs_cleanup (proc);
|
||||
proc_mutexes_cleanup (proc);
|
||||
|
||||
pmm_free (proc->pdata.kernel_stack, KSTACK_SIZE / PAGE_SIZE);
|
||||
|
||||
Reference in New Issue
Block a user