9927f9df5a5a9075bc7fc232ade5f51a8a400176
[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
16     // This is just used to mask the uninitialized loads in the known bugs to
17     // show that even without the CDSChecker's internal check, CDSSpec can
18     // also
19     // detects the known bug.
20     void *newArray;
21 } Deque;
22
23 Deque * create_size(int size);
24 Deque * create();
25 int take(Deque *q);
26 void resize(Deque *q);
27 void push(Deque *q, int x);
28 int steal(Deque *q);
29
30 #define EMPTY 0xffffffff
31 #define ABORT 0xfffffffe
32
33 /** @Define:
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 bool succ(int res);
39 bool fail(int res);
40
41 #ifdef __cplusplus
42 };
43 #endif
44 */
45
46 #endif