#include #include #include #include #include void proc_sqs_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); }