X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=action.cc;h=5e050810e7526408828b27c74cad76fcdef95a4b;hb=7dddcdb767f02f9b0c470ac516b18ad91a35d43d;hp=c1adc2e7bc65cd94d26a4b7cf93ac3482c2b2d1a;hpb=b8b39c87557325a384faa45d0cae56a6f71f52b1;p=model-checker.git diff --git a/action.cc b/action.cc index c1adc2e..5e05081 100644 --- a/action.cc +++ b/action.cc @@ -7,7 +7,7 @@ #include "action.h" #include "clockvector.h" #include "common.h" -#include "threads.h" +#include "threads-model.h" #include "nodestack.h" #define ACTION_INITIAL_CLOCK 0 @@ -33,7 +33,8 @@ ModelAction::ModelAction(action_type_t type, memory_order order, void *loc, reads_from(NULL), node(NULL), seq_number(ACTION_INITIAL_CLOCK), - cv(NULL) + cv(NULL), + sleep_flag(false) { Thread *t = thread ? thread : thread_current(); this->tid = t->get_id(); @@ -414,3 +415,18 @@ void ModelAction::print() const } else printf("\n"); } + +/** @brief Print nicely-formatted info about this ModelAction */ +unsigned int ModelAction::hash() const +{ + unsigned int hash=(unsigned int) this->type; + hash^=((unsigned int)this->order)<<3; + hash^=seq_number<<5; + hash^=tid<<6; + + if (is_read()) { + if (reads_from) + hash^=reads_from->get_seq_number(); + } + return hash; +}