Boost logo

Boost :

From: bill_kempf (williamkempf_at_[hidden])
Date: 2002-01-19 11:49:29


--- In boost_at_y..., "David Abrahams" <david.abrahams_at_r...> wrote:
>
> ----- Original Message -----
> From: "bill_kempf" <williamkempf_at_h...>
>
>
> > I hesitate to say this because I don't want to argue the point
too
> > much since I mostly agree with the idea in general. However,
> > allocating it on the stack will be no more disastrous (probably
less
> > so) then sharing it across threads. In other words I'd
envisioned
> > the usage to be like that of the scoped_lock classes, meant to be
> > used on the stack and never shared between threads. The user can
> > violate this, but if they do it's a simple programming error. We
> > can't prevent them from shooting themselves in the foot.
>
> In this case, sure we can. Shouldn't we, just on principle?

If we fix it so they can place the object on the heap safely we've
still not fixed it so they can't then share this object across
threads. The only way to fix that would be to synchronize the state
information which will add a lot of overhead just to protect the user
from a VERY dubious practice.

Or are you suggesting we employ one of the techniques to prevent the
user from even being able to place one of these on the heap?

Bill Kempf


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