Sharing in D

Walter Bright newshound1 at digitalmars.com
Fri Aug 1 10:22:16 PDT 2008


Sean Kelly wrote:
> == Quote from Walter Bright (newshound1 at digitalmars.com)'s article
>> If conventional code were generated for i++, and i was accessed from
>> multiple threads, the code is *broken*.
> 
> Not necessarily.  If i is a 32-bit number and only one thread is
> doing the writing then the code could be perfectly safe.

If you've got only one thread, why is it shared ? If it is shared, 
there's the possibility of multiple threads, and so the code is wrong 
wrong wrong.




More information about the Digitalmars-d mailing list