|
Boost Users : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-03-24 08:30:32
Caleb Epstein wrote:
> On Thu, 24 Mar 2005 01:29:57 +0200, Peter Dimov <pdimov_at_[hidden]>
> 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).
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net