aboutsummaryrefslogtreecommitdiff
path: root/inc/lib/queue.h
diff options
context:
space:
mode:
authorMarvin Borner2023-05-30 23:05:30 +0200
committerMarvin Borner2023-05-30 23:33:39 +0200
commitcbd21e1da0d763225e7ea3594d4e6d8e96863790 (patch)
treedae4242584e178b59337ca247aa532805af0d8d0 /inc/lib/queue.h
parente78acdabd1436083c503a5f1860ecdf14f3ee1bd (diff)
Added hash-based approach
Diffstat (limited to 'inc/lib/queue.h')
-rw-r--r--inc/lib/queue.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/inc/lib/queue.h b/inc/lib/queue.h
new file mode 100644
index 0000000..b0d22ef
--- /dev/null
+++ b/inc/lib/queue.h
@@ -0,0 +1,23 @@
+// Copyright (c) 2023, Marvin Borner <dev@marvinborner.de>
+// SPDX-License-Identifier: MIT
+
+#ifndef SHARING_QUEUE_H
+#define SHARING_QUEUE_H
+
+struct queue_node {
+ void *data;
+ struct queue_node *next;
+};
+
+struct queue {
+ struct queue_node *head;
+ struct queue_node *tail;
+};
+
+struct queue *queue_new(void);
+void queue_free(struct queue *queue);
+void queue_push(struct queue *queue, void *data);
+void *queue_pop(struct queue *queue);
+int queue_empty(struct queue *queue);
+
+#endif