+#define ACTION_INITIAL_CLOCK 0
+
+/**
+ * @brief Construct a new ModelAction
+ *
+ * @param type The type of action
+ * @param order The memory order of this action. A "don't care" for non-ATOMIC
+ * actions (e.g., THREAD_* or MODEL_* actions).
+ * @param loc The location that this action acts upon
+ * @param value (optional) A value associated with the action (e.g., the value
+ * read or written). Defaults to a given macro constant, for debugging purposes.
+ * @param thread (optional) The Thread in which this action occurred. If NULL
+ * (default), then a Thread is assigned according to the scheduler.
+ */
+ModelAction::ModelAction(action_type_t type, memory_order order, void *loc,
+ uint64_t value, Thread *thread) :
+ type(type),
+ order(order),
+ location(loc),
+ value(value),
+ reads_from(NULL),
+ node(NULL),
+ seq_number(ACTION_INITIAL_CLOCK),
+ cv(NULL),
+ sleep_flag(false)
+{
+ Thread *t = thread ? thread : thread_current();
+ this->tid = t->get_id();
+}
+
+/** @brief ModelAction destructor */
+ModelAction::~ModelAction()
+{
+ /**
+ * We can't free the clock vector:
+ * Clock vectors are snapshotting state. When we delete model actions,
+ * they are at the end of the node list and have invalid old clock
+ * vectors which have already been rolled back to an unallocated state.
+ */
+
+ /*
+ if (cv)
+ delete cv; */
+}
+
+void ModelAction::copy_from_new(ModelAction *newaction)
+{
+ seq_number = newaction->seq_number;
+}
+
+void ModelAction::set_seq_number(modelclock_t num)
+{
+ ASSERT(seq_number == ACTION_INITIAL_CLOCK);
+ seq_number = num;
+}
+
+bool ModelAction::is_relseq_fixup() const
+{
+ return type == MODEL_FIXUP_RELSEQ;
+}
+
+bool ModelAction::is_mutex_op() const
+{
+ return type == ATOMIC_LOCK || type == ATOMIC_TRYLOCK || type == ATOMIC_UNLOCK;
+}
+
+bool ModelAction::is_lock() const
+{
+ return type == ATOMIC_LOCK;
+}
+
+bool ModelAction::is_unlock() const
+{
+ return type == ATOMIC_UNLOCK;
+}
+
+bool ModelAction::is_trylock() const
+{
+ return type == ATOMIC_TRYLOCK;
+}
+
+bool ModelAction::is_success_lock() const