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 *) {
model = new ModelChecker();
model->startChecker();
}
-
+
ModelExecution *execution = model->get_execution();
cdsc::snapmutex *m = execution->getMutexMap()->get(p_mutex);
return m->try_lock();