THRD_EXIT(3C) Standard C Library Functions THRD_EXIT(3C)
thrd_exit - terminate a thread
#include <threads.h>
_Noreturn void
thrd_exit(int res);
The thrd_exit() function terminates the calling thread, in a similar
way that exit(3C) terminates the calling process. If the calling
thread has not been detached, then the exit status information provided
in res is saved and can be retrieved by the use of the thrd_join(3C)
function.
When the thread exits, all signals will be blocked and various
destructors and clean up handlers will be called, such as those
registered with tss_create(3C). The act of thread termination does not
cause any process-wide resources, such as mutexes and file descriptors
to be released.
If a thread, other than the thread in which main() was first invoked
returns from its starting routine, it will implicitly call thrd_exit()
and set the return value to be its exit status.
The thrd_exit() function does not return, the calling thread is
terminated.
Standard
MT-LEVEL
MT-Safe
pthread_exit(3C), thr_exit(3C), attributes(7), threads(7)
illumos February 21, 2023 illumos
NAME
thrd_exit - terminate a thread
SYNOPSIS
#include <threads.h>
_Noreturn void
thrd_exit(int res);
DESCRIPTION
The thrd_exit() function terminates the calling thread, in a similar
way that exit(3C) terminates the calling process. If the calling
thread has not been detached, then the exit status information provided
in res is saved and can be retrieved by the use of the thrd_join(3C)
function.
When the thread exits, all signals will be blocked and various
destructors and clean up handlers will be called, such as those
registered with tss_create(3C). The act of thread termination does not
cause any process-wide resources, such as mutexes and file descriptors
to be released.
If a thread, other than the thread in which main() was first invoked
returns from its starting routine, it will implicitly call thrd_exit()
and set the return value to be its exit status.
RETURN VALUES
The thrd_exit() function does not return, the calling thread is
terminated.
INTERFACE STABILITY
Standard
MT-LEVEL
MT-Safe
SEE ALSO
pthread_exit(3C), thr_exit(3C), attributes(7), threads(7)
illumos February 21, 2023 illumos