diff options
author | Marvin Borner | 2023-05-30 13:28:49 +0200 |
---|---|---|
committer | Marvin Borner | 2023-05-30 13:28:49 +0200 |
commit | e78acdabd1436083c503a5f1860ecdf14f3ee1bd (patch) | |
tree | bffb492b16a4109f807f7e1cc6fe05ea0e13102c /inc/queue.h | |
parent | 75c40090e9302e11fc32863270360ef597a93933 (diff) |
Added basic queue implementation
Diffstat (limited to 'inc/queue.h')
-rw-r--r-- | inc/queue.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/inc/queue.h b/inc/queue.h new file mode 100644 index 0000000..5a704b4 --- /dev/null +++ b/inc/queue.h @@ -0,0 +1,24 @@ +// Copyright (c) 2023, Marvin Borner <dev@marvinborner.de> +// SPDX-License-Identifier: MIT + +#ifndef SHARING_QUEUE_H +#define SHARING_QUEUE_H + +#include <stddef.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); + +#endif |