THRD_EXIT(3C) Standard C Library Functions THRD_EXIT(3C)

thrd_exitterminate a thread

#include <threads.h>

_Noreturn void
thrd_exit(int res);

The () 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 () 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.

pthread_exit(3C), thr_exit(3C), attributes(7), threads(7)

February 21, 2023 OmniOS