edits
authorroot <root@dw-6.eecs.uci.edu>
Mon, 29 Jul 2019 21:40:11 +0000 (14:40 -0700)
committerroot <root@dw-6.eecs.uci.edu>
Mon, 29 Jul 2019 21:40:11 +0000 (14:40 -0700)
action.cc
action.h
pthread.cc

index 72cf972..f00a143 100644 (file)
--- a/action.cc
+++ b/action.cc
@@ -645,6 +645,7 @@ const char * ModelAction::get_type_str() const
        case THREAD_YIELD: return "thread yield";
        case THREAD_JOIN: return "thread join";
        case THREAD_FINISH: return "thread finish";
+       case THREADONLY_FINISH: return "pthread_exit finish";
 
        case PTHREAD_CREATE: return "pthread create";
        case PTHREAD_JOIN: return "pthread join";
index 7c79f43..d357066 100644 (file)
--- a/action.h
+++ b/action.h
@@ -52,6 +52,7 @@ typedef enum action_type {
        THREAD_YIELD,   // < A thread yield action
        THREAD_JOIN,    // < A thread join action
        THREAD_FINISH,  // < A thread completion action
+       THREADONLY_FINISH,      // < A thread completion action
        PTHREAD_CREATE, // < A pthread creation action
        PTHREAD_JOIN,   // < A pthread join action
        ATOMIC_UNINIT,  // < Represents an uninitialized atomic
index 120d365..0234cda 100644 (file)
@@ -55,8 +55,8 @@ 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));
 }
 
 int pthread_mutex_init(pthread_mutex_t *p_mutex, const pthread_mutexattr_t *) {