[static] [shared] [const|immutable]

BCS none at anon.com
Thu May 14 09:44:02 PDT 2009


Hello Lionello,

> "Christopher Wright" <dhasenan at 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();
    }
}




More information about the Digitalmars-d-learn mailing list