X-Git-Url: http://plrg.eecs.uci.edu/git/?p=model-checker.git;a=blobdiff_plain;f=clockvector.cc;h=5f068e9025fffe3667a508196c155defa9421bbd;hp=0945bcf751dcd7eca5de6159affea9db49c58e3f;hb=7641eae45f89c0df9ba21d4ca43f1ebafdcb5bd8;hpb=9508fe09d2eeaaf7fbe7193d9cb81b3bc66316b5 diff --git a/clockvector.cc b/clockvector.cc index 0945bcf..5f068e9 100644 --- a/clockvector.cc +++ b/clockvector.cc @@ -1,7 +1,6 @@ #include #include -#include "model.h" #include "action.h" #include "clockvector.h" #include "common.h" @@ -17,13 +16,16 @@ */ ClockVector::ClockVector(ClockVector *parent, ModelAction *act) { - num_threads = model->get_num_threads(); + ASSERT(act); + num_threads = int_to_id(act->get_tid()) + 1; + if (parent && parent->num_threads > num_threads) + num_threads = parent->num_threads; + clock = (modelclock_t *)snapshot_calloc(num_threads, sizeof(int)); if (parent) std::memcpy(clock, parent->clock, parent->num_threads * sizeof(modelclock_t)); - if (act) - clock[id_to_int(act->get_tid())] = act->get_seq_number(); + clock[id_to_int(act->get_tid())] = act->get_seq_number(); } /** @brief Destructor */ @@ -93,7 +95,7 @@ modelclock_t ClockVector::getClock(thread_id_t thread) { void ClockVector::print() const { int i; - model_print("CV: ("); + model_print("("); for (i = 0; i < num_threads; i++) model_print("%2u%s", clock[i], (i == num_threads - 1) ? ")\n" : ", "); }