Expose fixed queue capacity
diff --git a/osi/include/fixed_queue.h b/osi/include/fixed_queue.h
index 42e72d8..12e8e75 100644
--- a/osi/include/fixed_queue.h
+++ b/osi/include/fixed_queue.h
@@ -39,6 +39,10 @@
// not be NULL.
bool fixed_queue_is_empty(fixed_queue_t *queue);
+// Returns the maximum number of elements this queue may hold. |queue| may
+// not be NULL.
+size_t fixed_queue_capacity(fixed_queue_t *queue);
+
// Enqueues the given |data| into the |queue|. The caller will be blocked
// if nore more space is available in the queue. Neither |queue| nor |data|
// may be NULL.
diff --git a/osi/src/fixed_queue.c b/osi/src/fixed_queue.c
index 621a712..5637507 100644
--- a/osi/src/fixed_queue.c
+++ b/osi/src/fixed_queue.c
@@ -91,6 +91,12 @@
return is_empty;
}
+size_t fixed_queue_capacity(fixed_queue_t *queue) {
+ assert(queue != NULL);
+
+ return queue->capacity;
+}
+
void fixed_queue_enqueue(fixed_queue_t *queue, void *data) {
assert(queue != NULL);
assert(data != NULL);