X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=pthread.cc;fp=pthread.cc;h=e453f1b27e45b2188c73231fbac3d436cd15ac6a;hb=7bba6b355f7b2250aed59de4b9d20f36c89a3eb4;hp=b5fb7ce964200750a108412c63041de7cea56c3d;hpb=8899359d333648c680e9a1aecf34b45a1eb6a201;p=c11tester.git diff --git a/pthread.cc b/pthread.cc index b5fb7ce9..e453f1b2 100644 --- a/pthread.cc +++ b/pthread.cc @@ -24,10 +24,8 @@ int pthread_create(pthread_t *t, const pthread_attr_t * attr, 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; } @@ -54,7 +52,7 @@ int pthread_detach(pthread_t t) { /* 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; } @@ -205,7 +203,7 @@ int pthread_cond_timedwait(pthread_cond_t *p_cond, 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");