Multithreading in D

Konstantin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Oct 8 12:13:05 PDT 2014


Hello D-World,

I've written a small terraingenerator in D based on the 
Hill-Algorithm.

To generate a terrain I only need to call the method 
generateTerrain(...) which returns a float-Array containing the 
height of each pixel (2D Array mapped with a 1D array with length 
resolution^2).

What I'd like to do:
Generate #treads seperate maps in a own thread and combine and 
normalize them afterwards.

I have little to no experience working with multiple threads. I 
tried it once in java for University but did not really get 
working.

What I imagine as solution (I know it won't work this way, but to 
give you a better idea):

for(int i = 0; i < #threads; i++){
     runInThread(generateTerrain(...));
}

Greetings and thanks in advance Konstantin


More information about the Digitalmars-d-learn mailing list