NAME

pthread_exit - thread termination
pthread_join - join at termination
pthread_detach - recovers memory from exiting thread

SYNOPSIS

#include <pthread.h>

void pthread_exit(void *status);
int pthread_join(pthread_t thread, void **value_ptr);
int pthread_detach(pthread_t thread);

DESCRIPTION

pthread_exit() terminates the calling thread. The pointer status is passed to the joining thread as a pointer to a pointer.
pthread_join() waits for the other thread and when it terminates it receives a pointer to a message which may be null in which case no message is passed. Multiple calls to pthread_join() by a collection of threads is undefined behavior.
pthread_detach() is typically used with pthread_join() to recover memory that the thread may not have released.

RETURN VALUES

pthread_exit() does not returns to its caller.
pthread_join() returns zero if successful or an error number.
pthread_detach() returns zero if successful or an error number.

ERRORS

pthread_join() fails with the following errors if:

EINVAL
The implementation has detected that the value specified by thread does not refer to a joinable thread or the thread is otherwise not detachable.
ESRCH
No thread could be found corresponding to that specified by the given thread ID.
EDEADLK
A deadlock was detected or the value of thread specifies the calling thread.

pthread_detach() fails with the following errors if:

EINVAL
The implementation has detected that the value specified by thread does not refer to a joinable thread.
ESRCH
No thread could be found corresponding to that specified by the given thread ID.

SEE ALSO

pthread_create()

Home page (Kernel)


< Copyright Rowebots Research Inc. and Multiprocessor Toolsmiths Inc. 1987-2018 >