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;
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())
history(new ModelHistory()),
execution(new ModelExecution(this, scheduler)),
execution_number(1),
- curr_thread_num(INITIAL_THREAD_ID),
+ curr_thread_num(MAIN_THREAD_ID),
trace_analyses(),
inspect_plugin(NULL)
{
execution->collectActions();
}
- curr_thread_num = INITIAL_THREAD_ID;
+ curr_thread_num = MAIN_THREAD_ID;
Thread *thr = getNextThread(old);
if (thr != nullptr) {
scheduler->set_current_thread(thr);
scheduler->set_current_thread(NULL);
/** Reset curr_thread_num to initial value for next execution. */
- curr_thread_num = INITIAL_THREAD_ID;
+ curr_thread_num = MAIN_THREAD_ID;
/** If we have more executions, we won't make it past this call. */
finish_execution(execution_number < params.maxexecutions);