EXTEXIT(2)

NAME
extexit - terminate the calling lwp or process and perform action

LIBRARY
libc

SYNOPSIS
#include <unistd.h>
void
extexit(int how, int status, void *addr);

DESCRIPTION
The extexit() function terminates a lwp or process and performs an action. This is a low level service routine not intended to be used from common user code.

The extexit() function can be used to either exit a lwp or a complete process. This is done by specifying either EXTEXIT_PROC or EXTEXIT_LWP in how. If exiting the process or if exiting the last lwp of a process, extexit() behaves like _exit(2) called with the status argument.

Additionally, extexit() can be used to perform certain actions when exiting. The following actions can be specified by or'ing these values in the how argument:

EXTEXIT_SETINT
    Set the integer variable pointer to by addr to the value of status. This is intended to enable other threads or processes to detect the termination of the calling lwp or process.

RETURN VALUES
The extexit() function will only return if it was invoked with invalid arguments. In this case, errno will be set to EINVAL. In the case of a successful invocation, extexit() will not return.

In case of an error, the action specified in how will not be performed. If an error occurs while performing an action, the results are undefined. However, extexit() will try hard to avoid such a situation. In any case, if an error occurs while performing an action, extexit() will return.

SEE ALSO
_exit(2), wait(2), exit(3)

HISTORY
The extexit() function first appeared in DragonFly 1.9.