Sharvil Nanavati | c11b407 | 2014-05-02 23:55:09 -0700 | [diff] [blame^] | 1 | #pragma once |
| 2 | |
| 3 | #include "list.h" |
| 4 | |
| 5 | struct fixed_queue_t; |
| 6 | typedef struct fixed_queue_t fixed_queue_t; |
| 7 | |
| 8 | typedef void (*fixed_queue_free_cb)(void *data); |
| 9 | |
| 10 | fixed_queue_t *fixed_queue_new(size_t capacity); |
| 11 | |
| 12 | // Freeing a queue that is currently in use (i.e. has waiters |
| 13 | // blocked on it) resuls in undefined behaviour. |
| 14 | void fixed_queue_free(fixed_queue_t *queue, fixed_queue_free_cb free_cb); |
| 15 | |
| 16 | void fixed_queue_enqueue(fixed_queue_t *queue, void *data); |
| 17 | void *fixed_queue_dequeue(fixed_queue_t *queue); |