implemented deque for work stealing
[IRC.git] / Robust / src / Runtime / deque.h
1 #ifndef ___DEQUE_H__
2 #define ___DEQUE_H__
3
4 #include "runtime.h"
5 #include "memPool.h"
6
7
8 // the bottom and top 64-bit values encode
9 // several sub-values, see deque.c
10 typedef struct deque_t {
11   MemPool* memPool;
12   INTPTR   bottom;
13
14   // force bottom and top to different cache lines
15   char buffer[CACHELINESIZE];
16
17   INTPTR top;
18 } deque;
19
20
21 void  dqInit      ( deque* dq );
22 void  dqPushBottom( deque* dq, void* item );
23 void* dqPopTop    ( deque* dq );
24 void* dqPopBottom ( deque* dq );
25
26
27 // pop operations may return these values
28 // instead of an item
29 extern void* DQ_POP_EMPTY;
30 extern void* DQ_POP_ABORT;
31
32
33 //void dq_take ( deque* sem, struct garbagelist* gl );
34
35
36 #endif // ___DEQUE_H__