BCS wrote:
Hello Lionello,
"Christopher Wright" <dhase...@gmail.com> wrote in message
The point of a shared local variable is to pass it to another thread
or set of threads, which will then be able to mutate it without
trouble.
As before, how can an int (value type) on the stack ever be shared
with another thread? It would always have to be copied... Can you give
me an example please?
// without lookin up the details of threading
void main()
{
int i;
with(new Thread({i++;}))
{
Start();
Wait();
}
}
:O Indeed, that works! Which is scary, since the compiler did not detect
the access to 'i' from another thread. In this case the code is safe,
but only because of the Wait/join at the end..
This looks like a hole in the shared/tls system and there's nothing the
compiler can do about it. :(
L.