thr_exit(3thread) thr_exit(3thread)
NAME
thr_exit - terminate execution of the calling thread
SYNOPSIS
cc [options] -Kthread file
#include <thread.h>
void thr_exit(void *status);
Parameters
status the exit value of the thread
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(3thread).
If the start function of the thread [see thr_create(3thread)]
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 may be
cast to (void *). See Warnings in the USAGE section below.
After thr_exit has been called, all thread-specific data
bindings are discarded [see thr_keycreate(3thread)], and the
thread data structures may be recycled.
thr_exit will terminate the process when it is called by the
last thread not created with the THR_DAEMON flag. In this
implementation, thr_exit passes the status to exit(2) when
terminating the process.
A call to thr_exit by the initial thread does not terminate
the process, unless it is the last non-daemon thread.
Return Values
thr_exit does not return a value.
Errors
None
USAGE
Copyright 1994 Novell, Inc. Page 1
thr_exit(3thread) thr_exit(3thread)
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
exit(2), thr_create(3thread), thr_getspecific(3thread),
thr_join(3thread), thr_keycreate(3thread),
thr_setspecific(3thread), thread(3thread)
Copyright 1994 Novell, Inc. Page 2