This terminates the current thread. Whether it's immediately removed from the system or inserted into the dead queue of the scheduler depends on its join type which was specified at spawning time. If it has the attribute PTH_ATTR_JOINABLE set to FALSE, it's immediately removed and value is ignored. Else the thread is inserted into the dead queue and value remembered for a subsequent pth_join(3) call by another thread. If invoked on the "main" thread this function waits for all other threads to terminate, kills the threading system and then terminates the process returning the value.