Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-01-21 07:48:29


From: "bill_kempf" <williamkempf_at_[hidden]>
> --- In boost_at_y..., "Peter Dimov" <pdimov_at_m...> wrote:
> > From: "bill_kempf" <williamkempf_at_h...>
> > > I've uploaded the draft document for the next generation of
> > > boost::thread for discussion.
> >
> > One thing that immediately jumps at me is:
> >
> > Requires: category() != foreign and there has been no previous
> calls to
> > either join() or detach() on any thread objects representing the
> same thread
> > of execution as *this.
> >
> > but I (the user) have no means to detect whether the requirements
> are met.
>
> To detect, no, but know, possibly. It depends heavily on the design
> of the application.

Consider this example:

void f(boost::thread & t)
{
// ...
    t.join();
}

I'd like to assert() on the precondition before calling t.join().

Isn't it possible to make the thread object remember whether join() or
detach() have been called?

--
Peter Dimov
Multi Media Ltd.

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