static struct list_head *queue_pop(struct queue *q) { struct list_head *r = queue_peek(q); if (r) { list_del(r); /* have we just emptied the bottom level? */ if (list_empty(q->qs)) queue_shift_down(q); } return r; }
/* * Gives us the oldest entry of the lowest popoulated level. If the first * level is emptied then we shift down one level. */ static struct list_head *queue_pop(struct queue *q) { unsigned level; struct list_head *r; for (level = 0; level < NR_QUEUE_LEVELS; level++) if (!list_empty(q->qs + level)) { r = q->qs[level].next; list_del(r); /* have we just emptied the bottom level? */ if (level == 0 && list_empty(q->qs)) queue_shift_down(q); return r; } return NULL; }