Threading Questions

bitwise via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Sep 28 20:05:29 PDT 2015


On Monday, 28 September 2015 at 11:47:38 UTC, Russel Winder wrote:
> I hadn't answered as I do not have answers to the questions you 
> ask. My reason: people should not be doing their codes using 
> these low-level shared memory techniques. Data parallel things 
> should be using the std.parallelism module. Dataflow-style 
> things should be using spawn and channels – akin to the way you 
> do things in Go.
>
> So to give you an answer I would go back a stage, forget 
> threads, mutexes, synchronized, etc. and ask what do you want 
> you workers to do? If they are to do something and return a 
> result then spawn and channel is exactly the right abstraction 
> to use. Think "farmer–worker", the farmer spawns the workers 
> and then collects their results. No shared memory anywyere – at 
> least not mutable.

https://www.youtube.com/watch?v=S7pGs7JU7eM

     Bit


More information about the Digitalmars-d-learn mailing list