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_thread(new ModelAction(PTHREAD_CREATE, std::memory_order_seq_cst, t, (uint64_t)¶ms));
return 0;
}
ModelExecution *execution = model->get_execution();
Thread *th = execution->get_pthread(t);
- model->switch_to_master(new ModelAction(PTHREAD_JOIN, std::memory_order_seq_cst, th, id_to_int(th->get_id())));
+ model->switch_thread(new ModelAction(PTHREAD_JOIN, std::memory_order_seq_cst, th, id_to_int(th->get_id())));
if ( value_ptr ) {
// store return value
/* 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;
}
void pthread_exit(void *value_ptr) {
Thread * th = thread_current();
th->set_pthread_return(value_ptr);
- model->switch_to_master(new ModelAction(THREADONLY_FINISH, std::memory_order_seq_cst, th));
+ model->switch_thread(new ModelAction(THREADONLY_FINISH, std::memory_order_seq_cst, th));
//Need to exit so we don't return to the program
real_pthread_exit(NULL);
}
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");