From 82357a7b7cc6e7395609894a8c8a705aa5af7e4e Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Fri, 1 Feb 2013 15:07:56 -0800 Subject: [PATCH] promise: add is_compatible() --- promise.cc | 9 +++++++++ promise.h | 1 + 2 files changed, 10 insertions(+) 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; -- 2.34.1