#include <stdio.h>
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
-#include <vector>
#include "model.h"
#include "action.h"
#define ACTION_INITIAL_CLOCK 0
+/** A special value to represent a successful trylock */
+#define VALUE_TRYSUCCESS 1
+
+/** A special value to represent a failed trylock */
+#define VALUE_TRYFAILED 0
+
/**
* @brief Construct a new ModelAction
*
return type == THREAD_START;
}
+bool ModelAction::is_thread_join() const
+{
+ return type == THREAD_JOIN;
+}
+
bool ModelAction::is_relseq_fixup() const
{
return type == MODEL_FIXUP_RELSEQ;
cv = new ClockVector(NULL, this);
}
-void ModelAction::set_try_lock(bool obtainedlock) {
- if (obtainedlock)
- value = VALUE_TRYSUCCESS;
- else
- value = VALUE_TRYFAILED;
+void ModelAction::set_try_lock(bool obtainedlock)
+{
+ value = obtainedlock ? VALUE_TRYSUCCESS : VALUE_TRYFAILED;
}
/**
if (idx >= 0)
model_print(" Rf: P%-2d", idx);
else
- model_print(" RF: P? ");
+ model_print(" Rf: P? ");
} else
model_print(" Rf: ? ");
}
hash ^= seq_number << 5;
hash ^= id_to_int(tid) << 6;
- if (is_read() && reads_from)
- hash ^= reads_from->get_seq_number();
+ if (is_read()) {
+ if (reads_from)
+ hash ^= reads_from->get_seq_number();
+ else if (reads_from_promise)
+ hash ^= model->get_promise_number(reads_from_promise);
+ hash ^= get_reads_from_value();
+ }
return hash;
}