thr_exit(THREAD)
thr_exit --
terminate execution of the calling thread
Synopsis
cc [options] -Kthread file
#include <thread.h>
void thr_exit(void *status);
Description
thr_exit terminates execution of the calling thread.
status is the exit value
of the terminating thread.
The status will be returned to one of any sibling threads
that call
thr_join(THREAD).
If the start function of the thread (see
thr_create(THREAD))
returns without calling thr_exit,
thr_exit is called implicitly
with status set to the return
value of the function.
No error checking of status is done,
as other values can be cast to (void *)
(see Warnings).
After thr_exit has been called,
all thread-specific data bindings are discarded
[see
thr_keycreate(THREAD)],
and the thread data structures can be recycled.
Parameters
status-
the exit value of the thread
Return values
thr_exit does not return a value.
Errors
None
Warnings
For portability, use status only as a pointer;
do not cast an int to void * to be used as the status
argument, and then cast it back to int when it is retrieved
by thr_join.
The ANSI C standard does not require that implementations
cast values to (void *) and then back to the initial type
without losing information.
References
Intro(THREAD),
exit(S),
thr_create(THREAD),
thr_getspecific(THREAD),
thr_join(THREAD),
thr_keycreate(THREAD),
thr_setspecific(THREAD)
Notices
There are three ways a threaded process terminates:
-
Any thread in the process calls exit.
-
All non-daemon threads in the process terminate.
-
The initial call to main returns without
calling thr_exit.
A call to thr_exit by the initial thread
does not terminate the process,
unless it is the last non-daemon thread.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005