X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=blobdiff_plain;f=pthread.cc;fp=pthread.cc;h=272626d5bfc8e911c0520368520548360f562ca5;hp=c96777488ee8cae08c20dcf88ab98d4c20e5caf3;hb=6898da1b7c46ddf3427ea0127dc68f8cc6016511;hpb=e9e6aaed0177ca95f216a59a284464262c835c3c diff --git a/pthread.cc b/pthread.cc index c9677748..272626d5 100644 --- a/pthread.cc +++ b/pthread.cc @@ -55,8 +55,10 @@ int pthread_detach(pthread_t t) { void pthread_exit(void *value_ptr) { Thread * th = thread_current(); - model->switch_to_master(new ModelAction(THREAD_FINISH, std::memory_order_seq_cst, th)); - while(1) ;//make warning goaway + th->set_pthread_return(value_ptr); + model->switch_to_master(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); } int pthread_mutex_init(pthread_mutex_t *p_mutex, const pthread_mutexattr_t *) { @@ -108,7 +110,7 @@ int pthread_mutex_trylock(pthread_mutex_t *p_mutex) { model = new ModelChecker(); model->startChecker(); } - + ModelExecution *execution = model->get_execution(); cdsc::snapmutex *m = execution->getMutexMap()->get(p_mutex); return m->try_lock();