|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Defined in header <threads.h> | ||
_Noreturnvoid thrd_exit(int res); | (since C11) (until C23) | |
[[noreturn]]void thrd_exit(int res); | (since C23) | |
First, for every thread-specific storage key which was created with a non-null destructor and for which the associated value is non-null (seetss_create),thrd_exit sets the value associated with the key toNULL and then invokes the destructor with the previous value of the key. The order in which the destructors are invoked is unspecified.
If, after this, there remain keys with both non-null destructors and values (e.g. if a destructor executedtss_set), the process is repeated up toTSS_DTOR_ITERATIONS times.
Finally, thethrd_exit function terminates execution of the calling thread and sets its result code tores.
If the last thread in the program is terminated withthrd_exit, the entire program terminates as if by callingexit withEXIT_SUCCESS as the argument (so the functions registered byatexit are executed in the context of that last thread)
Contents |
| res | - | the result value to return |
(none)
(C11) | blocks until a thread terminates (function)[edit] |
(C11) | detaches a thread (function)[edit] |