3 * @brief Promise class --- tracks future obligations for execution
4 * related to weakly ordered writes.
11 #include "threads-model.h"
14 #include "modeltypes.h"
18 modelclock_t expiration;
24 Promise(ModelAction *read, struct future_value fv) :
25 num_available_threads(0),
27 expiration(fv.expiration),
32 eliminate_thread(read->get_tid());
34 modelclock_t get_expiration() const { return expiration; }
35 ModelAction * get_action() const { return read; }
36 bool eliminate_thread(thread_id_t tid);
37 void add_thread(thread_id_t tid);
38 bool thread_is_available(thread_id_t tid) const;
39 bool has_failed() const;
40 uint64_t get_value() const { return value; }
41 void set_write(const ModelAction *act) { write = act; }
42 const ModelAction * get_write() { return write; }
43 int get_num_available_threads() { return num_available_threads; }
44 bool is_compatible(const ModelAction *write) const;
50 /** @brief Thread ID(s) for thread(s) that potentially can satisfy this
52 std::vector< bool, SnapshotAlloc<bool> > available_thread;
54 int num_available_threads;
57 const modelclock_t expiration;
59 /** @brief The action which reads a promised value */
60 ModelAction * const read;
62 const ModelAction *write;