Thorsten Froehlich wrote:
Hi,
I noticed that when using thread::join and the thread has already completed,
I'm not sure whether you mean that the thread has exited or that it has also been joined.
at least on Mac OS X using pthreads, pthread_join returns EINVAL, thus triggering the assertion res == 0. Is this intentional or a bug?
Which part of this behaviour are you questioning? The reasons why pthread_join may fail all represent bugs rather than unpredictable errors, hence the assertion. Joining a thread makes the thread object an empty shell which has no further use. Detaching a thread also makes it non-joinable and makes the thread object almost useless. If your program attempts to join a non-joinable thread, that's the bug. Otherwise, it is conceivable that you have found a bug in MacOS X or in Boost.Threads, but I'd be surprised. Ben.