case READ_FROM_FUTURE: {
/* Read from future value */
struct future_value fv = node->get_future_value();
- Promise *promise = new Promise(curr, fv);
+ Promise *promise = new Promise(this, curr, fv);
curr->set_read_from_promise(promise);
promises->push_back(promise);
mo_graph->startChanges();
Thread * get_thread(thread_id_t tid) const;
Thread * get_thread(const ModelAction *act) const;
- int get_promise_number(const Promise *promise) const;
bool is_enabled(Thread *t) const;
bool is_enabled(thread_id_t tid) const;
#include <inttypes.h>
#include "promise.h"
-#include "model.h"
+#include "execution.h"
#include "schedule.h"
#include "action.h"
#include "threads-model.h"
/**
* @brief Promise constructor
+ * @param execution The execution which is creating this Promise
* @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) :
+Promise::Promise(const ModelExecution *execution, ModelAction *read, struct future_value fv) :
+ execution(execution),
num_available_threads(0),
fv(fv),
readers(1, read),
/** @brief Get this Promise's index within the execution's promise array */
int Promise::get_index() const
{
- return model->get_promise_number(this);
+ return execution->get_promise_number(this);
}
#include "stl-model.h"
class ModelAction;
+class ModelExecution;
struct future_value {
uint64_t value;
class Promise {
public:
- Promise(ModelAction *read, struct future_value fv);
+ Promise(const ModelExecution *execution, ModelAction *read, struct future_value fv);
bool add_reader(ModelAction *reader);
ModelAction * get_reader(unsigned int i) const;
unsigned int get_num_readers() const { return readers.size(); }
SNAPSHOTALLOC
private:
+ /** @brief The execution which created this Promise */
+ const ModelExecution *execution;
+
/** @brief Thread ID(s) for thread(s) that potentially can satisfy this
* promise */
SnapVector<bool> available_thread;