[dmd-concurrency] Smoke test
    Walter Bright 
    walter at digitalmars.com
       
    Fri Jan  8 00:36:30 PST 2010
    
    
  
Sean Kelly wrote:
>
> I feel like I'm not explaining myself very well, but that's the best I can do at the moment.  As a related issue, I have a feeling that the following is a bad idea, but I haven't come up with a good explanation for why yet, maybe simply the principle of least surprise?:
>
> class C
> {
>     shared int x;
> }
>
> auto c = new C;
> sendRefToAnotherThread( c ); // fails, c is local
> sendToAnotherThread( &c.x ); // succeeds, c.x is shared
>
>   
The transitivity of shared doesn't work backwards, only forwards. In 
other words, you can have a local pointer to shared, but no shared 
pointers to locals.
In yet other words, sharing is transitive, locality is not.
    
    
More information about the dmd-concurrency
mailing list