From: Greg Colvin (gcolvin_at_[hidden])
Date: 2001-06-28 09:49:53
From: Peter Dimov <pdimov_at_[hidden]>
> From: <williamkempf_at_[hidden]>
> > --- In boost_at_y..., "Greg Colvin" <gcolvin_at_u...> wrote:
> > > I prefer detach, so that an explicit detach() function is
> > > not needed. It's easy enough to join() when appropriate.
> > > But then I've yet to write an application that needed to
> > > join.
> > Our experiences differ. I very rarely have need for a detached
> > thread.
> My limited experience with threads has always followed the pattern "spawn a
> worker thread to perform lengthy operation X without blocking the main
> thread, leaving it responsive." (Minor variations include "to perform
> background operation Y", like keeping a buffer full of data.)
> What is the usual 'join' model?
"And join the worker thread when the main thread needs the
result of the work."
A join isn't the only way to do this, or course. My apps
tend to leave the worker thread waiting for the next piece
of work and use a monitor to synchronize.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk