From: Brian Norris Date: Tue, 1 May 2012 20:24:35 +0000 (-0700) Subject: model: index thread_map by int, not thread_id_t X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=612a0d9b6537c8c24bcbaed2cf23a73fff65f5f1 model: index thread_map by int, not thread_id_t --- diff --git a/model.cc b/model.cc index f541d48d..18d7dd8a 100644 --- a/model.cc +++ b/model.cc @@ -37,7 +37,7 @@ ModelChecker::~ModelChecker() void ModelChecker::reset_to_initial_state() { DEBUG("+++ Resetting to initial state +++\n"); - std::map::iterator it; + std::map::iterator it; for (it = thread_map.begin(); it != thread_map.end(); it++) delete (*it).second; thread_map.clear(); @@ -58,7 +58,7 @@ Thread * ModelChecker::schedule_next_thread() Thread *t; if (nextThread == THREAD_ID_T_NONE) return NULL; - t = thread_map[nextThread]; + t = thread_map[id_to_int(nextThread)]; if (t == NULL) DEBUG("*** error: thread not in thread_map: id = %d\n", nextThread); return t; @@ -219,7 +219,7 @@ void ModelChecker::print_summary(void) int ModelChecker::add_thread(Thread *t) { - thread_map[t->get_id()] = t; + thread_map[id_to_int(t->get_id())] = t; scheduler->add_thread(t); return 0; } diff --git a/model.h b/model.h index 3e644f27..b2bcb96f 100644 --- a/model.h +++ b/model.h @@ -51,7 +51,7 @@ public: int add_thread(Thread *t); void remove_thread(Thread *t); - Thread * get_thread(thread_id_t tid) { return thread_map[tid]; } + Thread * get_thread(thread_id_t tid) { return thread_map[id_to_int(tid)]; } thread_id_t get_next_id(); @@ -75,7 +75,7 @@ private: ucontext_t *system_context; action_list_t *action_trace; - std::map thread_map; + std::map thread_map; class TreeNode *rootNode, *currentNode; std::list backtrack_list; };