Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-03-27 14:50:16


Howard Hinnant wrote:

> I'm beginning to think:
>
> multijoin() const
> {
> // Don't want to pretend to join with non-existent
> // (or detached) thread, make noise
> if (handle_ == 0)
> throw ?;
> while (!tl->done)
> tl->cv1.wait();
> }
>
> join()
> {
> multijoin();
> detach();
> }

I think it should be more like:

multijoin() const // try, timed same
{
    if( handle_ != 0 ) // the NULL thread is considered terminated
     while (!tl->done)
         tl->cv1.wait();
}

join()
{
    if( handle_ == 0 ) assert, throw acc. to taste
    multijoin();
    detach();
    *this = std::thread();
}

I still think that the user would be free to build destructive join/detach
upon the provided interface and that we don't really have to provide them.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk