summaryrefslogtreecommitdiffstats
path: root/lock_free_queue.h
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2013-01-30 11:37:51 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2013-01-30 11:37:51 +0100
commit3e68cf92ed7c9eeba4df08228bda9284856ad0da (patch)
tree3fa61d40b3802be38ac793845456f25ec5de613e /lock_free_queue.h
parent6c00c032781b379be5dd49fb97fef7085d836631 (diff)
downloadlock_free-3e68cf92ed7c9eeba4df08228bda9284856ad0da.zip
lock_free-3e68cf92ed7c9eeba4df08228bda9284856ad0da.tar.gz
cleanup lock_free_queue
Diffstat (limited to 'lock_free_queue.h')
-rw-r--r--lock_free_queue.h44
1 files changed, 30 insertions, 14 deletions
diff --git a/lock_free_queue.h b/lock_free_queue.h
index 14a2cae..0bce83e 100644
--- a/lock_free_queue.h
+++ b/lock_free_queue.h
@@ -1,31 +1,47 @@
/*
* File : lock_free_queue.h
* Author : Jérémy Zurcher <jeremy@asynk.ch>
- * Date : 01/11/09
+ * Date : 2009/11/01
* License : stolen from http://www.cs.rochester.edu/~scott/papers/1996_PODC_queues.pdf
*/
+#ifndef _LOCK_FREE_QUEUE_H_
+#define _LOCK_FREE_QUEUE_H_
+
+# ifdef __cplusplus
+extern "C" {
+# endif /* __cplusplus */
+
struct node;
-typedef union pointer {
- struct {
+typedef union pointer
+{
+ struct
+ {
volatile struct node *ptr;
volatile unsigned int count;
- } split;
- volatile unsigned long long concat;
+ } split;
+ volatile unsigned long long concat;
} pointer_t;
-typedef struct node {
- void *data;
- pointer_t next;
+typedef struct node
+{
+ void *data;
+ pointer_t next;
} node_t;
-typedef struct queue {
- pointer_t head;
- pointer_t tail;
+typedef struct queue
+{
+ pointer_t head;
+ pointer_t tail;
} lfq_t;
-void init( lfq_t *q );
-void enqueue( lfq_t *q, void *data );
-void* dequeue( lfq_t *q );
+void init(lfq_t *q);
+void enqueue(lfq_t *q, void *data);
+void* dequeue(lfq_t *q);
+
+# ifdef __cplusplus
+}
+# endif /* __cplusplus */
+# endif /* _LOCK_FREE_QUEUE_H_ */