how to harvest the results of tasks from a taskpool?

Martin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 5 06:55:22 PDT 2017


Hi,

i have a coulpe of different machines with MySQL Servers running 
on it.
Now, i want to execute queries for all Databases at the same time 
and collect the Result to process it.

I am new to the parallelism - so maybe i understand something 
totaly wrong.
What i tring is something like this:

<code>
{
  auto tPool = new TaskPool();
  forach(server ; servers)
  {
   auto task = task!queryWorker(query);
   tPool.put(task);
  }

  tPool.finish(true);
//--------> how to collect the results now? <-------

}

row[] queryWorker(string query) {

  //rows = result of the query

  return rows;
}
</code>

btw.. how to markup code in this forum?


More information about the Digitalmars-d-learn mailing list