[plt-scheme] Calling virtual C++-functions from other MzScheme-threads
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