On 24 Aug 2013 11:25, "Moritz Maxeiner" <moritz@ucworks.org> wrote:
>
> 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?
>
I have no idea if shared on the class makes all it's parts shared.
It was a struct but I had problems with passing it to the spawn func when I was using std.concurrent .
I'm trying to port a cassandra cql library from go so it's really just to help with that.
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.
Sorry I'm rambling...