if (waitq->last_waiter == NULL) { /* *Thewaitqisempty,soformtheinitialcircularlistbyself-linkingthe *initialwaiter.
*/
waiter->next_waiter = waiter;
} else { /* Splice the new waiter in at the end of the waitq. */
waiter->next_waiter = waitq->last_waiter->next_waiter;
waitq->last_waiter->next_waiter = waiter;
}
/* In both cases, the waiter we added to the list becomes the last waiter. */
waitq->last_waiter = waiter;
waitq->length += 1;
}
/** *vdo_waitq_transfer_all_waiters()-Transferallwaitersfromonewaitqto *asecondwaitq,emptyingthefirstwaitq. *@from_waitq:Thewaitqcontainingthewaiterstomove. *@to_waitq:Thewaitqthatwillreceivethewaitersfromthefirstwaitq.
*/ void vdo_waitq_transfer_all_waiters(struct vdo_wait_queue *from_waitq, struct vdo_wait_queue *to_waitq)
{ /* If the source waitq is empty, there's nothing to do. */ if (!vdo_waitq_has_waiters(from_waitq)) return;
/* Drain the copied waitq, invoking the callback on every entry. */ while (vdo_waitq_has_waiters(&waiters))
vdo_waitq_notify_next_waiter(&waiters, callback, context);
}
if (first_waiter == last_waiter) { /* The waitq has a single entry, so empty it by nulling the tail. */
waitq->last_waiter = NULL;
} else { /* *Thewaitqhasmultiplewaiters,sosplicethefirstwaiterout *ofthecircularwaitq.
*/
last_waiter->next_waiter = first_waiter->next_waiter;
}
/* The waiter is no longer in a waitq. */
first_waiter->next_waiter = NULL;
waitq->length -= 1;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.