X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=promise.cc;fp=promise.cc;h=8519feef5e678726b1ea2369e48a35e0d95631bd;hb=1ef66fffe44c297326b1043cab978789b1071704;hp=e38696ea4d119fd4d159656d3b3eed74443d8f3c;hpb=d496f3fa3c31e7f2ed84a2e19e9c2b3993dca1a7;p=model-checker.git diff --git a/promise.cc b/promise.cc index e38696e..8519fee 100644 --- a/promise.cc +++ b/promise.cc @@ -5,6 +5,22 @@ #include "model.h" #include "schedule.h" +/** + * @brief Promise constructor + * @param read The read which reads from a promised future value + * @param fv The future value that is promised + */ +Promise::Promise(ModelAction *read, struct future_value fv) : + num_available_threads(0), + value(fv.value), + expiration(fv.expiration), + read(read), + write(NULL) +{ + add_thread(fv.tid); + eliminate_thread(read->get_tid()); +} + /** * Eliminate a thread which no longer can satisfy this promise. Once all * enabled threads have been eliminated, this promise is unresolvable.