Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-08-08 08:41:02


At 01:08 AM 8/8/2001, Darryl Green wrote:

>...
>Beman suggests that another thread should expect
>evil consequences if it tries to access the stack
>of a terminated thread and that this is similar
>(identical) to what will happen in a single
>threaded environment if an attempt is made to
>access the stack of a function that has returned.
>This is true, but it is relatively easy to avoid
>in the single threaded case. It is very hard to
>avoid unknowingly making a similar error in a
>multi-threaded program.

Can that really be said as a blanket statement?

I can easily think of cases where it would be true, mostly involving
designs with dynamically changing numbers of threads.

But other designs involve a small number of always present (during
processing of work) threads with very fixed roles. They are all started
initially, process for awhile, and then terminate together. If one of them
went away unexpectedly during the processing phase, it would mean the
program was totally trashed. In my own case, these are mostly batch
processing programs not normally subject to outside disturbance.

We might want to warn against the practice of sharing (via pointers and
references) automatic storage objects, but we would need to be specific as
to when it is a problem.

--Beman


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