/** A no-op, for now */
void thrd_yield(void)
{
- model->switch_to_master(new ModelAction(THREAD_YIELD, std::memory_order_seq_cst, thread_current(), VALUE_NONE));
+ model->switch_thread(new ModelAction(THREAD_YIELD, std::memory_order_seq_cst, thread_current(), VALUE_NONE));
}
thrd_t thrd_current(void)
void ModelChecker::startRunExecution(Thread *old)
{
-
if (params.traceminsize != 0 &&
execution->get_curr_seq_num() > checkfree) {
checkfree += params.checkthreshold;
if (act && execution->is_enabled(thr) && !execution->check_action_enabled(act)) {
scheduler->sleep(thr);
}
-
- chooseThread(act, thr);
+ chooseThread(act, thr);
}
return nextThread;
}
+/* Swap back to system_context and terminate this execution */
void ModelChecker::finishRunExecution(Thread *old)
{
scheduler->set_current_thread(NULL);
chosen_thread->set_pending(NULL);
chosen_thread = NULL;
// Allow this thread to stash the next pending action
- if (should_terminate_execution())
- finishRunExecution(th);
- else
+// if (should_terminate_execution())
+// finishRunExecution(th);
+// else
startRunExecution(th);
} else {
/* Consume the next action for a Thread */
if (break_execution)
break;
- thread_chosen = false;
- curr_thread_num = 1;
startRunExecution(NULL);
} while (!should_terminate_execution());
struct pthread_params params = { start_routine, arg };
- ModelAction *act = new ModelAction(PTHREAD_CREATE, std::memory_order_seq_cst, t, (uint64_t)¶ms);
-
/* seq_cst is just a 'don't care' parameter */
- model->switch_to_master(act);
+ model->switch_to_master(new ModelAction(PTHREAD_CREATE, std::memory_order_seq_cst, t, (uint64_t)¶ms));
return 0;
}
/* Take care of both pthread_yield and c++ thread yield */
int sched_yield() {
- model->switch_to_master(new ModelAction(THREAD_YIELD, std::memory_order_seq_cst, thread_current(), VALUE_NONE));
+ model->switch_thread(new ModelAction(THREAD_YIELD, std::memory_order_seq_cst, thread_current(), VALUE_NONE));
return 0;
}
cdsc::snapcondition_variable *v = execution->getCondMap()->get(p_cond);
cdsc::snapmutex *m = execution->getMutexMap()->get(p_mutex);
- model->switch_to_master(new ModelAction(ATOMIC_TIMEDWAIT, std::memory_order_seq_cst, v, (uint64_t) m));
+ model->switch_thread(new ModelAction(ATOMIC_TIMEDWAIT, std::memory_order_seq_cst, v, (uint64_t) m));
m->lock();
// model_print("Timed_wait is called\n");