1 /* 2 ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. 3 ** Distributed under the terms of the NewOS License. 4 */ 5 #ifndef _KERNEL_QUEUE_H 6 #define _KERNEL_QUEUE_H 7 8 #include <kernel.h> 9 10 typedef struct queue { 11 void *head; 12 void *tail; 13 int count; 14 } queue; 15 16 int queue_init(queue *q); 17 int queue_remove_item(queue *q, void *e); 18 int queue_enqueue(queue *q, void *e); 19 void *queue_dequeue(queue *q); 20 void *queue_peek(queue *q); 21 22 typedef struct fixed_queue { 23 void **table; 24 int head; 25 int tail; 26 int count; 27 int size; 28 } fixed_queue; 29 30 int fixed_queue_init(fixed_queue *q, int size); 31 void fixed_queue_destroy(fixed_queue *q); 32 int fixed_queue_enqueue(fixed_queue *q, void *e); 33 void *fixed_queue_dequeue(fixed_queue *q); 34 void *fixed_queue_peek(fixed_queue *q); 35 36 #endif 37 38