X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=clockvector.cc;h=0b325281007e35505f993c2f9798f5b02765621c;hb=c2b7fc251420c50f51bf9c7f07f37d82b2bfc068;hp=0945bcf751dcd7eca5de6159affea9db49c58e3f;hpb=634ad19a6e82ddefd9c30d01523fc7fb42540c4c;p=model-checker.git diff --git a/clockvector.cc b/clockvector.cc index 0945bcf..0b32528 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 */