#include <pthread.h> void pthread_exit( void *status );
The pthread_exit
routine is used to temrinate the calling thread.
The status
is made available to any successful join with the
terminating thread.
When a thread returns from its start routine, it results in an
implicit call to the pthread_exit
routine with the return
value of the function serving as the argument to pthread_exit
.
Any cancellation cleanup handlers that hace been pushed and not yet popped shall be popped in reverse of the order that they were pushed. After all cancellation cleanup handlers have been executed, if the thread has any thread-specific data, destructors for that data will be invoked.
Thread termination does not release or free any application visible resources including byt not limited to mutexes, file descriptors, allocated memory, etc.. Similarly, exitting a thread does not result in any process-oriented cleanup activity.
There is no concept of a single main thread in RTEMS as there is in
a tradition UNIX system. POSIX requires that the implicit return of
the main thread results in the same effects as if there were a call
to exit
. This does not occur in RTEMS.
All access to any automatic variables allocated by the threads is lost when the thread exits. Thus references (i.e. pointers) to local variables of a thread should not be used in a global manner without care. As a specific example, a pointer to a local variable should NOT be used as the return value.
Copyright © 1988-2000 OAR Corporation