forked from chaoran/fast-wait-free-queue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
queue.h
43 lines (30 loc) · 790 Bytes
/
queue.h
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
#ifndef QUEUE_H
#define QUEUE_H
#ifdef WFQUEUE
#include "wfqueue.h"
#elif LCRQ
#include "lcrq.h"
#elif CCQUEUE
#include "ccqueue.h"
#elif MSQUEUE
#include "msqueue.h"
#elif FAAQ
#include "align.h"
typedef struct {
volatile long P DOUBLE_CACHE_ALIGNED;
volatile long C DOUBLE_CACHE_ALIGNED;
} queue_t DOUBLE_CACHE_ALIGNED;
typedef int handle_t;
#elif DELAY
typedef int queue_t;
typedef int handle_t;
#else
#error "Please specify a queue implementation."
#endif
void queue_init(queue_t * q, int nprocs);
void queue_register(queue_t * q, handle_t * th, int id);
void enqueue(queue_t * q, handle_t * th, void * v);
void * dequeue(queue_t * q, handle_t * th);
void queue_free(queue_t * q, handle_t * h);
void handle_free(handle_t *h);
#endif /* end of include guard: QUEUE_H */