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;
23 Promise(ModelAction *act, struct future_value fv) :
25 expiration(fv.expiration),
29 eliminate_thread(act->get_tid());
31 modelclock_t get_expiration() const { return expiration; }
32 ModelAction * get_action() const { return read; }
33 bool eliminate_thread(thread_id_t tid);
36 * Check if a thread has already been eliminated from resolving this
38 * @param tid Thread ID of the thread to check
39 * @return True if the thread is already eliminated; false otherwise
41 bool thread_is_eliminated(thread_id_t tid) const
43 unsigned int id = id_to_int(tid);
44 if (id >= eliminated_thread.size())
46 return eliminated_thread[id];
49 bool has_failed() const;
50 uint64_t get_value() const { return value; }
51 void set_write(const ModelAction *act) { write = act; }
52 const ModelAction * get_write() { return write; }
56 std::vector<bool> eliminated_thread;
58 const modelclock_t expiration;
59 ModelAction * const read;
60 const ModelAction *write;