-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtqueue.h
More file actions
25 lines (18 loc) · 748 Bytes
/
tqueue.h
File metadata and controls
25 lines (18 loc) · 748 Bytes
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
#include <string.h>
typedef struct TQueueNode {
struct TQueueNode *next;
void *data;
} TQueueNode;
typedef struct TQueueNode *TQueue;
/* Adds a new element at the end of the list, returns its position */
unsigned long int tqueue_enqueue(TQueue *q, void *data);
/* Removes and returns the element at the beginning of the list, NULL if the
queue is empty */
void *tqueue_pop(TQueue *q);
/* Returns the number of elements in the list */
unsigned long int tqueue_size(TQueue q);
/* Returns a 'view' on the list starting at (a positive) offset distance,
* NULL if the queue is empty */
TQueue tqueue_at_offset(TQueue q, unsigned long int offset);
/* Returns the data on the first node of the given list */
void *tqueue_get_data(TQueue q);