#include "clockvector.h"
#include "common.h"
+#define ACTION_INITIAL_CLOCK 0
+
ModelAction::ModelAction(action_type_t type, memory_order order, void *loc, uint64_t value) :
type(type),
order(order),
location(loc),
value(value),
reads_from(NULL),
+ seq_number(ACTION_INITIAL_CLOCK),
cv(NULL)
{
Thread *t = thread_current();
this->tid = t->get_id();
- this->seq_number = model->get_next_seq_num();
}
ModelAction::~ModelAction()
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_mutex_op() const
{
return type == ATOMIC_LOCK || type == ATOMIC_TRYLOCK || type == ATOMIC_UNLOCK;
void set_node(Node *n) { node = n; }
void copy_from_new(ModelAction *newaction);
+ void set_seq_number(modelclock_t num);
void set_try_lock(bool obtainedlock);
bool is_mutex_op() const;
bool is_lock() const;
return newcurr;
}
+ curr->set_seq_number(get_next_seq_num());
+
newcurr = node_stack->explore_action(curr, scheduler->get_enabled());
if (newcurr) {
/* First restore type and order in case of RMW operation */
thread_id_t get_next_id();
int get_num_threads();
- modelclock_t get_next_seq_num();
/** @return The currently executing Thread. */
Thread * get_current_thread() { return scheduler->get_current_thread(); }
int num_feasible_executions;
bool promises_expired();
+ modelclock_t get_next_seq_num();
+
/**
* Stores the ModelAction for the current thread action. Call this
* immediately before switching from user- to system-context to pass