3 WaitObj::WaitObj(thread_id_t tid) :
10 void WaitObj::add_waiting_for(thread_id_t other, int dist)
12 waiting_for.add(other);
13 dist_table.put(other, dist);
16 void WaitObj::add_waited_by(thread_id_t other)
21 void WaitObj::remove_waiting_for(thread_id_t other)
23 waiting_for.remove(other);
24 dist_table.remove(other);
27 void WaitObj::remove_waited_by(thread_id_t other)
29 waited_by.remove(other);
32 int WaitObj::lookup_dist(thread_id_t other_id)
34 if (dist_table.contains(other_id))
35 return dist_table.get(other_id);
47 void WaitObj::print_waiting_for()
49 if (waiting_for.getSize() == 0)
52 model_print("thread %d is waiting for: ", tid);
53 thrd_id_set_iter * it = waiting_for.iterator();
55 while (it->hasNext()) {
56 thread_id_t thread_id = it->next();
57 model_print("%d ", thread_id);
62 void WaitObj::print_waited_by()
64 if (waited_by.getSize() == 0)
67 model_print("thread %d is waited by: ", tid);
68 thrd_id_set_iter * it = waited_by.iterator();
70 while (it->hasNext()) {
71 thread_id_t thread_id = it->next();
72 model_print("%d ", thread_id);