9 ModelChecker::ModelChecker()
11 /* First thread created (system_thread) will have id 1 */
12 this->used_thread_id = 0;
13 /* Initialize default scheduler */
14 this->scheduler = new DefaultScheduler();
16 this->current_action = NULL;
19 ModelChecker::~ModelChecker()
21 delete this->scheduler;
24 void ModelChecker::assign_id(struct thread *t)
26 t->id = ++this->used_thread_id;
29 void ModelChecker::add_system_thread(struct thread *t)
31 this->system_thread = t;
34 void ModelChecker::check_current_action(void)
36 if (this->current_action)
37 this->action_trace.push_back(this->current_action);
39 DEBUG("trying to push NULL action...\n");
42 void ModelChecker::print_trace(void)
44 std::list<class ModelAction *>::iterator it;
46 for (it = action_trace.begin(); it != action_trace.end(); it++) {
52 ModelAction::ModelAction(action_type_t type, memory_order order, void *loc, int value)
54 struct thread *t = thread_current();
55 ModelAction *act = this;
64 void ModelAction::print(void)
69 type_str = "thread create";
72 type_str = "thread yield";
75 type_str = "thread join";
78 type_str = "atomic read";
81 type_str = "atomic write";
84 type_str = "unknown type";
87 printf("Thread: %d\tAction: %s\tMO: %d\tLoc: %#014zx\tValue: %d\n", tid, type_str, order, (size_t)location, value);