diff th_util.h @ 276:1807059fb8f2

Move ringbuffer implementation.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 09 Jun 2011 11:37:34 +0300
parents 578730eebe07
children 21528fe535fb
line wrap: on
line diff
--- a/th_util.h	Fri Jun 03 15:16:52 2011 +0300
+++ b/th_util.h	Thu Jun 09 11:37:34 2011 +0300
@@ -111,6 +111,20 @@
 qlist_t * th_llist_find_func(qlist_t *list, const void *userdata, int (compare)(const void *, const void *));
 
 
+/* Ringbuffer implementation
+ */
+typedef struct {
+    void **data;
+    int n, size;
+    void (*deallocator)(void *);
+} qringbuf_t;
+
+qringbuf_t * th_ringbuf_new(const size_t size, void (*mdeallocator)(void *));
+BOOL        th_ringbuf_grow(qringbuf_t *buf, const size_t n);
+void        th_ringbuf_free(qringbuf_t *buf);
+void        th_ringbuf_add(qringbuf_t *buf, void *ptr);
+
+
 #ifdef __cplusplus
 }
 #endif