Caleb Epstein wrote:
On Thu, 24 Mar 2005 01:29:57 +0200, Peter Dimov
wrote: Caleb Epstein wrote:
Even if the underlying implementation thread is not (e.g. it has been pthread_detach'd or the equivalent)? Or are you suggesting that a join on a non-implementation-joinable thread should just succeed silently?
Succeed silently, yes. That's what join means: wait for the thread to finish. If it has already finished, join should just return immediately. Not only that, it should be safe to call it from multiple threads at the same time, which should result in exactly one call to pthread_join.
But what of the case of a detached thread that is still running?
A Boost thread is never detached. This is a POSIX-only thing to compensate lack of destructors in C. You either have a way to call join (in which case no pthread_detach should have been called), or you don't (in which case it doesn't matter whether pthread_detach has been called or not).