Просмотр исходного кода

Missed commit to changes for queue.h.

(Logical change 1.57)


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@196 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake 21 лет назад
Родитель
Сommit
0da6e1eac3
1 измененных файлов с 11 добавлено и 0 удалено
  1. 11 0
      include/queue.h

+ 11 - 0
include/queue.h

@@ -161,4 +161,15 @@ static inline int queue_item_iterator_next (struct queue *queue)
 	return (queue->iterator == queue->head);
 }
 
+static inline void queue_avail (struct queue *queue, int *avail)
+{
+	if (queue->head < queue->tail) {
+		*avail = queue->size - (queue->head + queue->size - queue->tail);
+	} else {
+		*avail = queue->size - (queue->head - queue->tail);
+	}
+	*avail -= 1;
+	assert (*avail >= 0);
+}
+
 #endif /* QUEUE_H_DEFINED */