Multithreading in D

Konstantin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 9 03:10:18 PDT 2014


> Are you looking for parallel? 
> http://dlang.org/library/std/parallelism/parallel.html

I have seen this, but I'm not sure how to use it.

Maybe:

float[][] maps = new float[#threads][resolution * resolution];

foreach(i, ref elem; parallel(maps)){
     elem = generateTerrain(...);
}

Does this look right?



More information about the Digitalmars-d-learn mailing list