#include "datarace.h"
#include "threads-model.h"
#include "bugmessage.h"
-#include "history.h"
#include "fuzzer.h"
-#include "newfuzzer.h"
#ifdef COLLECT_STAT
static unsigned int atomic_load_count = 0;
thrd_last_fence_release(),
priv(new struct model_snapshot_members ()),
mo_graph(new CycleGraph()),
-#ifdef NEWFUZZER
- fuzzer(new NewFuzzer()),
-#else
fuzzer(new Fuzzer()),
-#endif
isfinished(false)
{
/* Initialize a model-checker thread, for special ModelActions */
+ model_thread = new Thread(get_next_id());
+ add_thread(model_thread);
fuzzer->register_engine(m, this);
scheduler->register_engine(this);
#ifdef TLS
/** @brief Destructor */
ModelExecution::~ModelExecution()
{
- for (unsigned int i = 0;i < get_num_threads();i++)
+ for (unsigned int i = INITIAL_THREAD_ID;i < get_num_threads();i++)
delete get_thread(int_to_id(i));
delete mo_graph;
void ModelExecution::wake_up_sleeping_actions()
{
- for (unsigned int i = 0;i < get_num_threads();i++) {
+ for (unsigned int i = MAIN_THREAD_ID;i < get_num_threads();i++) {
thread_id_t tid = int_to_id(i);
if (scheduler->is_sleep_set(tid)) {
Thread *thr = get_thread(tid);
bool ModelExecution::is_deadlocked() const
{
bool blocking_threads = false;
- for (unsigned int i = 0;i < get_num_threads();i++) {
+ for (unsigned int i = MAIN_THREAD_ID;i < get_num_threads();i++) {
thread_id_t tid = int_to_id(i);
if (is_enabled(tid))
return false;
*/
bool ModelExecution::is_complete_execution() const
{
- for (unsigned int i = 0;i < get_num_threads();i++)
+ for (unsigned int i = MAIN_THREAD_ID;i < get_num_threads();i++)
if (is_enabled(int_to_id(i)))
return false;
return true;
add_normal_write_to_lists(act);
add_write_to_lists(act);
w_modification_order(act);
-#ifdef NEWFUZZER
- model->get_history()->process_action(act, act->get_tid());
-#endif
return act;
}
case ATOMIC_WAIT: {
Thread *curr_thrd = get_thread(curr);
/* wake up the other threads */
- for (unsigned int i = 0;i < get_num_threads();i++) {
+ for (unsigned int i = MAIN_THREAD_ID;i < get_num_threads();i++) {
Thread *t = get_thread(int_to_id(i));
if (t->waiting_on() == curr_thrd && t->get_pending()->is_lock())
scheduler->wake(t);
}
/* wake up the other threads */
- for (unsigned int i = 0;i < get_num_threads();i++) {
+ for (unsigned int i = MAIN_THREAD_ID;i < get_num_threads();i++) {
Thread *t = get_thread(int_to_id(i));
if (t->waiting_on() == curr_thrd && t->get_pending()->is_lock())
scheduler->wake(t);
// TODO: lock count for recursive mutexes
/* wake up the other threads */
Thread *curr_thrd = get_thread(curr);
- for (unsigned int i = 0;i < get_num_threads();i++) {
+ for (unsigned int i = MAIN_THREAD_ID;i < get_num_threads();i++) {
Thread *t = get_thread(int_to_id(i));
if (t->waiting_on() == curr_thrd && t->get_pending()->is_lock())
scheduler->wake(t);
}
/* Wake up any joining threads */
- for (unsigned int i = 0;i < get_num_threads();i++) {
+ for (unsigned int i = MAIN_THREAD_ID;i < get_num_threads();i++) {
Thread *waiting = get_thread(int_to_id(i));
if (waiting->waiting_on() == th &&
waiting->get_pending()->is_thread_join())
ASSERT(curr);
/* Process this action in ModelHistory for records */
-#ifdef NEWFUZZER
- model->get_history()->process_action( curr, curr->get_tid() );
-#endif
if (curr_thrd->is_blocked() || curr_thrd->is_complete())
scheduler->remove_thread(curr_thrd);