queue.h
1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* Copyright (C) 1996-1998 by the Board of Trustees
* of Leland Stanford Junior University.
*
* This file is part of the SimOS distribution.
* See LICENSE file for terms of the license.
*
*/
/* @TITLE "queue.h: queue data structure"*/
/*
* queue: this is a normal FIFO queue module, with a fixed maximum capacity.
*
* David Kotz 1994
*/
/* $Id: queue.h,v 1.1.1.1 2002/05/29 01:09:11 blythe Exp $ */
#ifndef QUEUE_H
#define QUEUE_H
typedef void *Qitem; /* a queue item is any pointer */
/* ******************************************************* */
/* CYCLE-COUNTED versions (only usable in USER mode) */
typedef struct queue_s QUEUE; /* Queue handle */
extern QUEUE *MakeQueue(int size, char *debugname); /* make a new queue */
extern void Enqueue(QUEUE *q, Qitem item);
extern void Dequeue(QUEUE *q, Qitem *item);
extern int InQueue(QUEUE *q); /* number currently in queue */
extern boolean EmptyQueue(QUEUE *q); /* TRUE if queue is empty */
extern void FreeQueue(QUEUE *q); /* destroy a queue */
/* ******************************************************* */
/* NON-CYCLE-COUNTED versions (also useful in ENGINE mode) */
typedef struct queue_noncyc_s NCQUEUE; /* Queue handle */
extern NCQUEUE *MakeQueue_noncyc(int size, char *debugname); /* new queue */
extern void Enqueue_noncyc(NCQUEUE *q, Qitem item);
extern void Dequeue_noncyc(NCQUEUE *q, Qitem *item);
extern int InQueue_noncyc(NCQUEUE *q); /* number currently in queue */
extern boolean EmptyQueue_noncyc(NCQUEUE *q); /* TRUE if queue is empty */
extern void FreeQueue_noncyc(NCQUEUE *q); /* destroy a queue */
#endif /* QUEUE_H */