From: bill_kempf (williamkempf_at_[hidden])
Date: 2002-01-21 08:32:27
--- In boost_at_y..., "Peter Dimov" <pdimov_at_m...> wrote:
> From: "bill_kempf" <williamkempf_at_h...>
> > --- 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
> > are met.
> > To detect, no, but know, possibly. It depends heavily on the
> > of the application.
> Consider this example:
> void f(boost::thread & t)
> // ...
> I'd like to assert() on the precondition before calling t.join().
> Isn't it possible to make the thread object remember whether join()
> detach() have been called?
For a single instance of the thread object, yes. To do so for all
thread objects, not with out going to a full blown thread_ref design.
I don't consider this much of a problem, however. This is really no
different then not being able to call delete twice for an object
(whether from the same pointer or from different pointers to the same
object). A well designed application will ensure this never occurs
simply through the normal tracking of ownership.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk