thr_exit(3thread)


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(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 can be cast to (void *) (see Warnings).

After thr_exit has been called, all thread-specific data bindings are discarded [see thr_keycreate(3thread)], 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(3thread), exit(2), thr_create(3thread), thr_getspecific(3thread), thr_join(3thread), thr_keycreate(3thread), thr_setspecific(3thread)

Notices

There are three ways a threaded process terminates:

A call to thr_exit by the initial thread does not terminate the process, unless it is the last non-daemon thread.


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004