3 * @brief Promise class --- tracks future obligations for execution
4 * related to weakly ordered writes.
13 #include "modeltypes.h"
20 modelclock_t expiration;
26 Promise(ModelAction *read, struct future_value fv);
27 bool add_reader(ModelAction *reader);
28 ModelAction * get_reader(unsigned int i) const;
29 unsigned int get_num_readers() const { return readers.size(); }
30 bool eliminate_thread(thread_id_t tid);
31 void add_thread(thread_id_t tid);
32 bool thread_is_available(thread_id_t tid) const;
33 bool has_failed() const;
34 void set_write(const ModelAction *act) { write = act; }
35 const ModelAction * get_write() const { return write; }
36 int get_num_available_threads() const { return num_available_threads; }
37 bool is_compatible(const ModelAction *act) const;
38 bool is_compatible_exclusive(const ModelAction *act) const;
40 modelclock_t get_expiration() const { return fv.expiration; }
41 uint64_t get_value() const { return fv.value; }
42 struct future_value get_fv() const { return fv; }
46 bool equals(const Promise *x) const { return this == x; }
47 bool equals(const ModelAction *x) const { return false; }
51 /** @brief Thread ID(s) for thread(s) that potentially can satisfy this
53 std::vector< bool, SnapshotAlloc<bool> > available_thread;
55 int num_available_threads;
57 const future_value fv;
59 /** @brief The action(s) which read the promised future value */
60 std::vector< ModelAction *, SnapshotAlloc<ModelAction *> > readers;
62 const ModelAction *write;