How to call stop from parallel foreach

seany seany at uni-bonn.de
Fri Jun 25 19:52:23 UTC 2021


On Friday, 25 June 2021 at 19:30:16 UTC, jfondren wrote:
> On Friday, 25 June 2021 at 19:17:38 UTC, seany wrote:
>> If i use `parallel(...)`it runs.
>>
>> If i use `prTaskPool.parallel(...`, then in the line : `auto 
>> prTaskPool = new TaskPool(threadCount);` it hits the error. 
>> Please help.
>
> parallel() reuses a single taskPool that's only established 
> once.
>
> Your code creates two TaskPools per a function invocation and 
> you
> call that function in a loop.
>
> stracing your program might again reveal the error you're 
> hitting.

I have removed one - same problem.
Yes, I do call it in a loop. how can I create a taskpool in a 
function that itself will be called in a loop?


More information about the Digitalmars-d-learn mailing list