pthread_join is able to return values
[c11tester.git] / threads.cc
index 77b13c69be0a9fb75f555edf3caa13e974ea5466..1a83283a680a8b071709b209db58fc12132756e7 100644 (file)
@@ -54,7 +54,9 @@ void thread_startup()
        if (curr_thread->start_routine != NULL) {
                curr_thread->start_routine(curr_thread->arg);
        } else if (curr_thread->pstart_routine != NULL) {
-               curr_thread->pstart_routine(curr_thread->arg);
+               // set pthread return value
+               void *retval = curr_thread->pstart_routine(curr_thread->arg);
+               curr_thread->set_pthread_return(retval);
        }
        /* Finish thread properly */
        model->switch_to_master(new ModelAction(THREAD_FINISH, std::memory_order_seq_cst, curr_thread));