Sharing in D

superdan super at dan.org
Fri Aug 1 10:31:18 PDT 2008


Walter Bright Wrote:

> 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.

i think he means a different case. you have many threads alright. but only one is incrementin'. others are just readin'.



More information about the Digitalmars-d mailing list