Esempio n. 1
0
File: proc.c Progetto: clarkok/CoS
static void
_proc_insert_into_queues(Process *proc)
{
    if (proc->priv_base >= PRIV_REALTIME) {
        Process *ptr = list_get(list_head(&proc_realtime_queue), Process, _link);
        while (ptr && ptr->priv_base >= proc->priv_base) {
            ptr = list_get(list_next(&ptr->_link), Process, _link);
        }
        if (ptr) {
            list_before(&ptr->_link, &proc->_link);
        }
        else {
            list_append(&proc_realtime_queue, &proc->_link);
        }
    }
    else if (proc->priv_base >= PRIV_NORMAL) {
        if (proc->ticks) {
            list_append(&proc_normal_queue, &proc->_link);
        }
        else {
            list_append(&proc_normal_noticks_queue, &proc->_link);
        }
    }
    else {
        list_append(&proc_zero_queue, &proc->_link);
    }
}
Esempio n. 2
0
list* list_before( list* l, void* split ) {
	list* nl = malloc( sizeof( list ));
	nl->head = l->head;
	nl->tail = ( l->tail->head != split ) ? list_before( l->tail, split ) : NULL;
	return nl;
}