[openbeos] Re: [OT] Re: Pointer or reference?

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Thu, 01 Apr 2004 17:12:25 +0200 CEST

"Steve Folta" <steve@xxxxxxxxx> wrote:
> >> This is also why creating objects on
> >> the stack is incorrect. An automatic (stack) variable can only be
> >> accessed from the thread that created it.
> > That's definitely wrong.  I'm certain I've accessed the stack from 
> > a
> > seperate thread.  In any case, I decided to run a test program.  I
> > initialized a int to 10 in one thread, later I displayed and 
> > changed the
> > value in another thread, the back in the first thread I displayed 
> > the
> > value again.  Everything worked perfectly and as expected.
> It can be done, but it requires very careful synchronization of the
> threads.  I'd consider it a bad practice.

As long as we're not talking about main() :-)

Bye,
   Axel.


Other related posts: