These functions provide basic wrapper functionality for creating and updating
the clock vector for a particular ModelAction.
#include "model.h"
#include "action.h"
#include "clockvector.h"
+#include "common.h"
ModelAction::ModelAction(action_type_t type, memory_order order, void *loc, int value)
{
return false;
}
+void ModelAction::create_cv(ModelAction *parent)
+{
+ ASSERT(cv == NULL);
+ if (parent)
+ cv = new ClockVector(parent->cv, this);
+ else
+ cv = new ClockVector();
+}
+
+void ModelAction::read_from(ModelAction *act)
+{
+ ASSERT(cv);
+ if (act->is_release() && this->is_acquire())
+ cv->merge(act->cv);
+ value = act->value;
+}
+
void ModelAction::print(void)
{
const char *type_str;
#define __ACTION_H__
#include <list>
+#include <cstddef>
+
#include "threads.h"
#include "libatomic.h"
#include "mymemory.h"
bool same_thread(ModelAction *act);
bool is_dependent(ModelAction *act);
+ void create_cv(ModelAction *parent = NULL);
+ void read_from(ModelAction *act);
+
inline bool operator <(const ModelAction& act) const {
return get_seq_number() < act.get_seq_number();
}