X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=promise.cc;h=ea5e7e635cf47df48a2ffc15fa0cd35d73b76025;hb=f06cd40fb350723b2dbe59f8c494b03a60f41b40;hp=fdd45791f40657556f344c96b579ade87bc90736;hpb=00b14c0561d3838aeb798d3c22f4136f8c4d136b;p=model-checker.git diff --git a/promise.cc b/promise.cc index fdd4579..ea5e7e6 100644 --- a/promise.cc +++ b/promise.cc @@ -83,5 +83,16 @@ bool Promise::has_failed() const */ bool Promise::is_compatible(const ModelAction *write) const { - return thread_is_available(write->get_tid()); + return thread_is_available(write->get_tid()) && read->same_var(write); +} + +/** + * @brief Check if a promise is compatible with a store and is exclusive to its + * thread + * @param write The store to check against + * @return True if we are compatible and exclusive; false otherwise + */ +bool Promise::is_compatible_exclusive(const ModelAction *write) const +{ + return get_num_available_threads() == 1 && is_compatible(write); }