From: Brian Norris Date: Fri, 1 Feb 2013 23:07:56 +0000 (-0800) Subject: promise: add is_compatible() X-Git-Tag: oopsla2013~304 X-Git-Url: http://demsky.eecs.uci.edu/git/?p=model-checker.git;a=commitdiff_plain;h=82357a7b7cc6e7395609894a8c8a705aa5af7e4e promise: add is_compatible() --- diff --git a/promise.cc b/promise.cc index 2bd6637..fdd4579 100644 --- a/promise.cc +++ b/promise.cc @@ -76,3 +76,12 @@ bool Promise::has_failed() const { return num_available_threads == 0; } + +/** + * @param write A store which could satisfy this Promise + * @return True if the store can satisfy this Promise; false otherwise + */ +bool Promise::is_compatible(const ModelAction *write) const +{ + return thread_is_available(write->get_tid()); +} diff --git a/promise.h b/promise.h index 8ff8c3e..8eec87b 100644 --- a/promise.h +++ b/promise.h @@ -41,6 +41,7 @@ class Promise { void set_write(const ModelAction *act) { write = act; } const ModelAction * get_write() { return write; } int get_num_available_threads() { return num_available_threads; } + bool is_compatible(const ModelAction *write) const; void print() const;