X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=blobdiff_plain;f=waitobj.h;h=36d95796461fa8e73718d9de125762cb5d2c353e;hp=26f7f1c778b133728bec3066cd754fe00f9b985b;hb=25d73096cfc14c655f94b01bb235cc5efd1d5696;hpb=c635df842e0738f2478bdd21a103155ee5c58c97 diff --git a/waitobj.h b/waitobj.h index 26f7f1c7..36d95796 100644 --- a/waitobj.h +++ b/waitobj.h @@ -4,18 +4,34 @@ #include "classlist.h" #include "modeltypes.h" +typedef HashTable dist_map_t; +typedef HashSet node_set_t; +typedef HSIterator node_set_iter; + class WaitObj { public: WaitObj(thread_id_t); - ~WaitObj() {} + ~WaitObj(); thread_id_t get_tid() { return tid; } + void add_waiting_for(thread_id_t other, FuncNode * node, int dist); + void add_waited_by(thread_id_t other); + bool remove_waiting_for_node(thread_id_t other, FuncNode * node); + void remove_waiting_for(thread_id_t other); + void remove_waited_by(thread_id_t other); + thrd_id_set_t * getWaitingFor() { return &waiting_for; } - thrd_id_set_t * getWaitingBy() { return &waited_by; } - int lookup_dist(thread_id_t other_tid); + thrd_id_set_t * getWaitedBy() { return &waited_by; } + + node_set_t * getTargetNodes(thread_id_t tid); + int lookup_dist(thread_id_t tid, FuncNode * target); + + bool incr_counter(thread_id_t tid); - void print_waiting_for(); + void clear_waiting_for(); + + void print_waiting_for(bool verbose = false); void print_waited_by(); SNAPSHOTALLOC @@ -28,7 +44,14 @@ private: /* The set of threads waiting for this thread */ thrd_id_set_t waited_by; - HashTable dist_table; + SnapVector thrd_dist_maps; + SnapVector thrd_target_nodes; + + /* Count the number of actions for threads that + * this thread is waiting for */ + SnapVector thrd_action_counters; + + dist_map_t * getDistMap(thread_id_t tid); }; #endif