Use simple_action_list for conditionvariable waiters
[c11tester.git] / actionlist.h
1 #ifndef ACTIONLIST_H
2 #define ACTIONLIST_H
3
4 #include "classlist.h"
5 #include "stl-model.h"
6
7 #define ISACT ((uintptr_t) 1ULL)
8 #define ACTMASK (~ISACT)
9
10 #define ALLBITS 4
11 #define ALLNODESIZE (1 << ALLBITS)
12 #define ALLMASK ((1 << ALLBITS)-1)
13 #define MODELCLOCKBITS 32
14
15 class allnode;
16 void decrementCount(allnode *);
17
18 class allnode {
19 public:
20         allnode();
21         ~allnode();
22         SNAPSHOTALLOC;
23
24 private:
25         allnode * parent;
26         allnode * children[ALLNODESIZE];
27         int count;
28         sllnode<ModelAction *> * findPrev(modelclock_t index);
29         friend class actionlist;
30         friend void decrementCount(allnode *);
31 };
32
33 class actionlist {
34 public:
35         actionlist();
36         ~actionlist();
37         void addAction(ModelAction * act);
38         void removeAction(ModelAction * act);
39         void clear();
40         bool isEmpty();
41         uint size() {return _size;}
42         sllnode<ModelAction *> * begin() {return head;}
43         sllnode<ModelAction *> * end() {return tail;}
44
45         SNAPSHOTALLOC;
46
47 private:
48         allnode root;
49         sllnode<ModelAction *> * head;
50         sllnode<ModelAction* > * tail;
51
52         uint _size;
53 };
54 #endif