UC3M

Telematic/Audiovisual Syst./Communication Syst. Engineering

Systems Architecture

September 2017 - January 2018

11.2.4.  Threads: The result of a thread

What a thread returns (with return or pthread_exit) can be accessed by its parent with a pthread_join function. The operating system does not return the control to a invocation on pthread_join until the thread on which it was invoked has completed execution. And so, the only way for a thread to transform data that another thread is processed exclusively during its execution; after the execution of the thread, they are released.

#include <pthread.h>
    int pthread_join(pthread_t thread, void **retval);
//Compile and link with -pthread.