On Thu, 24 Mar 2005 01:29:57 +0200, Peter Dimov
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? These are not joinable, and having join succeed for them would be misleading to the user, no? Or does a user who tries to join a detached thread get what s/he deserves?
pthread_join is join+destructor rolled into one, but we have "real" destructors in C++, so we don't need to emulate its behavior so strictly.
Yes, but I'd expect that if I successfully join a thread, that the thread would have well and truly stopped executing. I don't think there is any way to do that w/a detached pthread. -- Caleb Epstein caleb dot epstein at gmail dot com