Re: spawn X different workers & wait for results from all of them

2015-09-08 Thread Justin Whear via Digitalmars-d-learn
On Sat, 05 Sep 2015 12:21:33 +0200, Robert M. Münch wrote: > My "pieceOfWork" is not the same. So I don't have the case: Do 4 time > this 1thing. Instead, do 1 time these 4 things. Ah, so you want to receive one each of various types? Something like this might work (untested): //

Re: spawn X different workers & wait for results from all of them

2015-09-05 Thread Robert M. Münch via Digitalmars-d-learn
On 2015-09-04 17:32:48 +, Justin Whear said: How would receive know? Well, it could be pretty simple. At the moment: receive( int ..., long ..., myStruct ... ) Will wait for one out of the three. So it's an OR. reveive_all( int ..., long ...,

Re: spawn X different workers & wait for results from all of them

2015-09-05 Thread thedeemon via Digitalmars-d-learn
On Thursday, 3 September 2015 at 16:50:21 UTC, Robert M. Münch wrote: Hi, I'm not sure how to best implement the following: 1. I have 4 different tasks to do. 2. All can run in parallel 3. Every task will return some result that I need Now how to best do it? I think the Task and taskPool

Re: spawn X different workers & wait for results from all of them

2015-09-05 Thread Robert M. Münch via Digitalmars-d-learn
On 2015-09-05 15:44:02 +, thedeemon said: I think the Task and taskPool from std.parallelism are a good fit. Something like: auto task1 = task!fun1(params1); auto task2 = task!fun2(params2); auto task3 = task!fun3(params3); auto task4 = task!fun4(params4); taskPool.put(task1);

Re: spawn X different workers & wait for results from all of them

2015-09-04 Thread Justin Whear via Digitalmars-d-learn
On Thu, 03 Sep 2015 18:50:21 +0200, Robert M. Münch wrote: > Hi, I'm not sure how to best implement the following: > > 1. I have 4 different tasks to do. > 2. All can run in parallel 3. Every task will return some result that I > need > > Now how to best do it? When using receive() it fires on