From 9a82127c476bf99556bbc69e181025afcba19d26 Mon Sep 17 00:00:00 2001 From: nodist Date: Thu, 24 Sep 2026 14:36:15 -0400 Subject: ring buffer tests --- include/kpl/queue.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include/kpl/queue.h') diff --git a/include/kpl/queue.h b/include/kpl/queue.h index 3d77e13..977a32d 100644 --- a/include/kpl/queue.h +++ b/include/kpl/queue.h @@ -20,6 +20,11 @@ void kpl_task_queue_add(kpl_task_queue *task_queue, kpl_task *task); kpl_task *kpl_task_queue_next(kpl_task_queue *task_queue); +typedef enum : int8_t { + KPL_RING_QUEUE_MIN_POW2 = 4, + KPL_RING_QUEUE_MAX_POW2 = 30 +} kpl_ring_queue_pow2_sizes; + typedef struct { _Atomic ssize_t index; void *data; @@ -31,7 +36,7 @@ typedef struct { kpl_ring_queue_item *items; } kpl_ring_queue; -void kpl_ring_queue_init(kpl_ring_queue *ring_queue, int8_t size_pow); +bool kpl_ring_queue_init(kpl_ring_queue *ring_queue, int8_t size_pow2); void kpl_ring_queue_free(kpl_ring_queue *ring_queue); -- cgit v1.2.3