mthr_exit() terminates the execution of the calling thread. If it's a
detached thread, its stack and its thread structure will be freed after switching
to another thread. Therefore the exitvalue of a detached thread will be lost.
If the thread is nondetached, its stack will be freed, but the thread will remain as
zombie thread. By doing a mthr_join(3) on this zombie,
the terminated thread's exitvalue could be retrieved. At the same moment the
zombie will be freed by deallocating its thread structure.