[plt-scheme] Calling virtual C++-functions from other MzScheme-threads

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sat Nov 22 09:39:10 EST 2003

At 22 Nov 2003 01:05:26 +0100, Daniel K. Skovenborg wrote:
> Scheme_Object * tfoo (int argc, Scheme_Object * argv [])
> {
>   A a ;
>   pa = & a;
>   pa->foo ();
> 
>   while (true)
>     {
>       SCHEME_USE_FUEL (1);
>     }
> 
>   return scheme_void;
> };

If a value is stack-allocated, it must not be referenced from another
thread.

MzScheme threads are implemented by copying data into and outof the
stack, so the "a" object isn't there when a second thread tries to use
it.

Matthew



Posted on the users mailing list.