I'm porting some go code to D

Moritz Maxeiner moritz at ucworks.org
Sat Aug 24 02:20:07 PDT 2013


On Friday, 23 August 2013 at 23:54:55 UTC, Rory McGuire wrote:
> So I'm porting so #golang code to #dlang and there is all these 
> blasted
> "go" statements.So I thought I'd give implmenting it in D a 
> shot. What do
> you guys think?
> Fire away :).
>
> /**
>  * chan allows messaging between threads without having to deal 
> with locks,
> similar to how chan works in golang
>  */
> class chan_(T) {
>     shared Mutex lock;
>     struct Container(T) {
>         T value;
>         Container!T* next;

I'm probably missunderstanding somehting about the TLS model, but 
from what I know, for something like this, shouldn't you make the 
class instance itself go into shared storage instead instead of 
all the members?



More information about the Digitalmars-d-announce mailing list