This article is from the Threads Programming FAQ, by Bryan O'Sullivan firstname.lastname@example.org with numerous contributions by others.
UI threads allow programmers to join on any thread that happens to
terminate by passing the appropriate argument to thr_join(). This is
not possible under POSIX and, yes, there is a rationale behind the
absence of this feature.
Unix programmers are used to being able to call wait() in such a way
that it will return when "any" process exits, but expecting this to
work for threads can cause confusion for programmers trying to use
threads. The important thing to note here is that Unix processes are
based around a notion of parent and child; this is a notion that is
"not" present in most threads systems. Since threads don't contain
this notion, joining on "any" thread could have the undesirable effect
of having the join return once a completely unrelated thread happened
In many (perhaps even most) threaded applications, you do not want to
be able to join with any thread in your process. Consider, for
example, a library call that one of your threads might make, which in
its turn might start a few threads and try to join on them. If another
of your threads, joining on "any" thread, happened to join on one of
the library call's threads, that would lead to incorrect program
If you want to be able to join on any thread so that, for example, you
can keep track of the number of running threads, you can achieve the
same functionality by starting detached threads and having them
decrememnt a (suitably locked, of course) counter as they exit.