summaryrefslogtreecommitdiffstats
path: root/lf_ring_buffer_data.h
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2010-01-06 22:36:29 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2010-01-06 22:36:29 +0100
commit174afdb2c0eb0e418980c1fa1c0afe41277b5b4d (patch)
tree55a2901196983c31017dac6e4fa0f35e43dadd5e /lf_ring_buffer_data.h
parent80b8ee53cbf9e69f6831124f469358aa7d4e97d4 (diff)
downloadlock_free-174afdb2c0eb0e418980c1fa1c0afe41277b5b4d.zip
lock_free-174afdb2c0eb0e418980c1fa1c0afe41277b5b4d.tar.gz
lf_ring_buffer is almost good + tests
Diffstat (limited to 'lf_ring_buffer_data.h')
-rw-r--r--lf_ring_buffer_data.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/lf_ring_buffer_data.h b/lf_ring_buffer_data.h
new file mode 100644
index 0000000..cf6e9c9
--- /dev/null
+++ b/lf_ring_buffer_data.h
@@ -0,0 +1,21 @@
+
+typedef char rb_data_t;
+
+#define RB_DATA_LEN 63
+
+typedef struct buffer {
+ char status;
+ rb_data_t data[RB_DATA_LEN];
+} rb_buffer_t;
+
+#define LFRB_DATA_SIZE ( sizeof(rb_data_t)*RB_DATA_LEN )
+
+#define LFRB_BUFFER_TYPE rb_buffer_t
+#define LFRB_BUFFER_SIZE ( sizeof(rb_buffer_t) )
+
+#define LFRB_IS_AVAILABLE( el ) (el.status==0)
+#define LFRB_MARK_AS_FILLED( el ) { (el).status=1; }
+#define LFRB_MARK_AS_READ( el ) { (el).status=0; }
+#define LFRB_DATA_PTR( el ) (el).data
+
+