Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-08-30 07:14:47


From: "William Kempf" <williamkempf_at_[hidden]>
> The only grey area is your desire to treat the "initial thread"
differently
> from other "adopted" threads, but I'm not convinced that you should. A
> POSIX implementation would allow you to, but would require some "hacks"
that
> would result in restrictions on when you can call current() within the
> "initial thread".

The main thread is significantly different from other 'adopted' threads
assuming that such threads even exist. This is why it deserves special
treatment.

Every program has a main thread. Many (most?) programs don't have adopted
threads.

The second reason that the main thread is not like the other adopted threads
is because, for the other adopted threads, we assume that "whoever created
the thread will join or detach it." This is not true for the main thread. We
can offer full join support for the main thread.

Without additional support from the runtime, the only requirement on the
user code is that the first call to create() or current() (or the first
attempt to construct a boost::thread) is made from the initial thread. Which
is quite reasonable.

> >I agree, however I don't see how the abstract machine affects the
> >adoption/joining the main thread issue.
>
> The creation of the main thread is a property of the abstract machine.

I'm not a core language expert so I'll let this one pass. ;-)

--
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