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/process.h | 2 ++ include/kpl/queue.h | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/kpl/process.h b/include/kpl/process.h index b47e122..7d13daf 100644 --- a/include/kpl/process.h +++ b/include/kpl/process.h @@ -35,6 +35,8 @@ typedef struct _kpl_task { } kpl_task; typedef struct { + int32_t thread_id; + kpl_env *env; kpl_task_queue task_queue; _Atomic ssize_t priority; // TODO 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