Sharing in D

Walter Bright newshound1 at digitalmars.com
Fri Aug 1 01:59:29 PDT 2008


superdan wrote:
> fraid you might have a slightly specialized definition of what
> lock-free code is. i think you say that cas-based shit is lock free.
> but here, this is lock free:
> 
> data = 5.4; dataThere = true;
> 
> people use lock-free *everywhere*. just they don't call it that way.
> they just synchronize through atomic assignments.
> 
> i'm not sure at this point how d's shared will improve the above. if
> i understand that shit correctly you define data and dataThere as
> shared. then you know assignments occur in the proper sequence
> (because of the inserted fences and shit). if they weren't shared
> they could be assigned in the wrong order but nobody could tell. it's
> like the shit in the forest that don't stink because nobody's
> smellin'. and if they weren't shared they wouldn't be shareable to
> start with. so the whole shit works. is that true walt?

Yes.



More information about the Digitalmars-d mailing list