The CDSSpec checker's benchmarks
[model-checker-benchmarks.git] / chase-lev-deque-bugfix / deque.h
1 #ifndef DEQUE_H
2 #define DEQUE_H
3
4 #include <stdatomic.h>
5 #include <inttypes.h>
6
7 typedef struct {
8         atomic_size_t size;
9         atomic_int buffer[];
10 } Array;
11
12 typedef struct {
13         atomic_size_t top, bottom;
14         atomic_uintptr_t array; /* Atomic(Array *) */
15 } Deque;
16
17 Deque * create_size(int size);
18 Deque * create();
19 int take(Deque *q);
20 void resize(Deque *q);
21 void push(Deque *q, int x);
22 int steal(Deque *q);
23
24 #define EMPTY 0xffffffff
25 #define ABORT 0xfffffffe
26
27 /** @Define:
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 bool succ(int res);
33 bool fail(int res);
34
35 #ifdef __cplusplus
36 };
37 #endif
38 */
39
40 #endif