Create many objects using threads

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 5 14:01:02 PDT 2014


On 05/05/2014 01:38 PM, Caslav Sabani wrote:

 > I am struggling to understand from your example where is the code that
 > creates or spawns new thread.

The .parallel in the foreach loop makes the body of the loop be executed 
in parallel.

 > How do you create new thread and fill array with instantiated objects in
 > that thread?

It is automatic in that example but you can created thread explicitly by 
std.concurrency or core.thread as well.

Ali



More information about the Digitalmars-d-learn mailing list