add waitqueue_length()

personal/stbuehler/wip
Thomas Porzelt 14 years ago
parent bedcc3d46a
commit f9ca699307
  1. 3
      include/lighttpd/waitqueue.h
  2. 14
      src/waitqueue.c

@ -45,4 +45,7 @@ LI_API waitqueue_elem *waitqueue_pop(waitqueue *queue);
/* removes an element from the queue */
LI_API void waitqueue_remove(waitqueue *queue, waitqueue_elem *elem);
/* returns the length of the queue */
LI_API guint waitqueue_length(waitqueue *queue);
#endif

@ -103,4 +103,18 @@ void waitqueue_remove(waitqueue *queue, waitqueue_elem *elem) {
elem->next->prev = elem->prev;
elem->queued = FALSE;
elem->ts = 0;
}
guint waitqueue_length(waitqueue *queue) {
guint i = 0;
waitqueue_elem *elem = queue->head;
while (elem) {
i++;
elem = elem->next;
}
return i;
}

Loading…
Cancel
Save