model: convert while-loops to for-loops
[model-checker.git] / promise.cc
index e38696ea4d119fd4d159656d3b3eed74443d8f3c..0f5ba4d1573d3ffc652ad28edb3bc69e62742248 100644 (file)
@@ -4,6 +4,24 @@
 #include "promise.h"
 #include "model.h"
 #include "schedule.h"
+#include "action.h"
+#include "threads-model.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