future_value: add thread ID parameter
[model-checker.git] / promise.h
index ce5bea168f60cfacc4ee01efaad343a1db2c9039..3c0d5dddd7330e33f06bbc9c2a21320963e6fc4c 100644 (file)
--- a/promise.h
+++ b/promise.h
@@ -16,6 +16,7 @@
 struct future_value {
        uint64_t value;
        modelclock_t expiration;
+       thread_id_t tid;
 };
 
 class Promise {
@@ -26,27 +27,20 @@ class Promise {
                read(act),
                write(NULL)
        {
-               increment_threads(act->get_tid());
+               eliminate_thread(act->get_tid());
        }
        modelclock_t get_expiration() const { return expiration; }
        ModelAction * get_action() const { return read; }
-       bool increment_threads(thread_id_t tid);
-
-       bool has_sync_thread(thread_id_t tid) {
-               unsigned int id = id_to_int(tid);
-               if (id >= synced_thread.size())
-                       return false;
-               return synced_thread[id];
-       }
-
-       bool check_promise() const;
+       bool eliminate_thread(thread_id_t tid);
+       bool thread_is_eliminated(thread_id_t tid) const;
+       bool has_failed() const;
        uint64_t get_value() const { return value; }
        void set_write(const ModelAction *act) { write = act; }
        const ModelAction * get_write() { return write; }
 
        SNAPSHOTALLOC
  private:
-       std::vector<bool> synced_thread;
+       std::vector< bool, SnapshotAlloc<bool> > eliminated_thread;
        const uint64_t value;
        const modelclock_t expiration;
        ModelAction * const read;