Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-08-06 08:12:10


At 01:22 AM 8/6/2001, Darryl Green wrote:

>I can't help thinking I must have misunderstood
>your point somehow? In what way did you envisage
>the sharing of stack data being useful - or were
>you just concerned that someone might have a use
>for it?

Think large noncopyable objects like files, created on the stack in one
thread and then passed by reference or pointer to other threads.

I have an app where the main thread opens an ifstream automatic (stack)
object. There's a static storage mutex protecting it. A pointer to the
ifstream object gets passed to worker threads. The worker threads read
input records to be processed from the stream.

That's totally commonplace code. It has to be conforming; C++ doesn't
have a notion of pointer to automatic being different from pointer to
static or pointer to dynamic memory.

--Beman


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