<p dir="ltr"><br>
On 24 Aug 2013 11:25, "Moritz Maxeiner" <<a href="mailto:moritz@ucworks.org">moritz@ucworks.org</a>> wrote:<br>
><br>
> On Friday, 23 August 2013 at 23:54:55 UTC, Rory McGuire wrote:<br>
>><br>
>> So I'm porting so #golang code to #dlang and there is all these blasted<br>
>> "go" statements.So I thought I'd give implmenting it in D a shot. What do<br>
>> you guys think?<br>
>> Fire away :).<br>
>><br>
>> /**<br>
>>  * chan allows messaging between threads without having to deal with locks,<br>
>> similar to how chan works in golang<br>
>>  */<br>
>> class chan_(T) {<br>
>>     shared Mutex lock;<br>
>>     struct Container(T) {<br>
>>         T value;<br>
>>         Container!T* next;<br>
><br>
><br>
> 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?<br>

><br>
I have no idea if shared on the class makes all it's parts shared. <br>
It was a struct but I had problems with passing it to the spawn func when I was using std.concurrent .</p>
<p dir="ltr">I'm trying to port a cassandra cql library from go so it's really just to help with that.</p>
<p dir="ltr">I'm having a hard time imagining how to implement select from go. Could probably use std.concurrent.receive because that can handle multiple types at once. </p>
<p dir="ltr">Sorry I'm rambling...</p>