void pthread_exit(void *value_ptr); The pthread_exit() function shall terminate the calling thread and make the value value_ptr available to any successful join with the terminating thread. 3.等待线程终止函数(pthread_join - wait for thread termination): #include
int pthread_join(pthread_t thread, void **value_ptr); The pthread_join() function shall suspend execution of the calling thread until the target thread terminates, unless the target thread has already terminated. On return from a successful pthread_join() call with a non-NULL value_ptr argument, the value passed to pthread_exit() by the terminating thread shall be made avail- able in the location referenced by value_ptr. When a pthread_join() returns suc- cessfully, the target thread has been terminated.