26f7f1c778b133728bec3066cd754fe00f9b985b
[c11tester.git] / waitobj.h
1 #ifndef __WAITOBJ_H__
2 #define __WAITOBJ_H__
3
4 #include "classlist.h"
5 #include "modeltypes.h"
6
7 class WaitObj {
8 public:
9         WaitObj(thread_id_t);
10         ~WaitObj() {}
11
12         thread_id_t get_tid() { return tid; }
13
14         thrd_id_set_t * getWaitingFor() { return &waiting_for; }
15         thrd_id_set_t * getWaitingBy() { return &waited_by; }
16         int lookup_dist(thread_id_t other_tid);
17
18         void print_waiting_for();
19         void print_waited_by();
20
21         SNAPSHOTALLOC
22 private:
23         thread_id_t tid;
24
25         /* The set of threads this thread (tid) is waiting for */
26         thrd_id_set_t waiting_for;
27
28         /* The set of threads waiting for this thread */
29         thrd_id_set_t waited_by;
30
31         HashTable<thread_id_t, int, int, 0> dist_table;
32 };
33
34 #endif