X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=promise.h;h=852fe714f896dfbffc0b409fcd499058841a1ee0;hb=09c3eb5539455e82dcb357fbce82bf5974c3a37c;hp=35515d24b2da913b387e5ec06b786a83e3d43877;hpb=3eb987279c382e0000de844728aceef2f360acf6;p=model-checker.git diff --git a/promise.h b/promise.h index 35515d2..852fe71 100644 --- a/promise.h +++ b/promise.h @@ -21,15 +21,15 @@ struct future_value { class Promise { public: - Promise(ModelAction *act, struct future_value fv) : + Promise(ModelAction *read, struct future_value fv) : num_available_threads(0), value(fv.value), expiration(fv.expiration), - read(act), + read(read), write(NULL) { add_thread(fv.tid); - eliminate_thread(act->get_tid()); + eliminate_thread(read->get_tid()); } modelclock_t get_expiration() const { return expiration; } ModelAction * get_action() const { return read; } @@ -39,8 +39,10 @@ class Promise { bool has_failed() const; uint64_t get_value() const { return value; } void set_write(const ModelAction *act) { write = act; } - const ModelAction * get_write() { return write; } - int get_num_available_threads() { return num_available_threads; } + const ModelAction * get_write() const { return write; } + int get_num_available_threads() const { return num_available_threads; } + bool is_compatible(const ModelAction *act) const; + bool is_compatible_exclusive(const ModelAction *act) const; void print() const; @@ -54,7 +56,10 @@ class Promise { const uint64_t value; const modelclock_t expiration; + + /** @brief The action which reads a promised value */ ModelAction * const read; + const ModelAction *write; };