c/thread/thrd exit

First, for every thread-specific storage key which was created with a non-null destructor and for which the associated value is non-null (see tss_create), sets the value associated with the key to  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 executed tss_set), the process is repeated up to tss_dtor_iterations times.

Finally, the function terminates execution of the calling thread and sets its result code to.

If the last thread in the program is terminated with, the entire program terminates as if by calling exit with exit_success as the argument (so the functions registered by atexit are executed in the context of that last thread)

Return value
(none)