How to call stop from parallel foreach
seany
seany at uni-bonn.de
Fri Jun 25 14:04:50 UTC 2021
On Friday, 25 June 2021 at 13:53:17 UTC, seany wrote:
> On Thursday, 24 June 2021 at 21:19:19 UTC, Ali Çehreli wrote:
>> [...]
>
> I tried this .
>
> int[][] pnts ;
> pnts.length = fld.length;
>
> enum threadCount = 2;
> auto prTaskPool = new TaskPool(threadCount);
>
> scope (exit) {
> prTaskPool.finish();
> }
>
> enum workUnitSize = 1;
>
> foreach(i, fLine; prTaskPool.parallel(fld, workUnitSize)) {
> //....
> }
>
>
> This is throwing random segfaults.
> CPU has 2 cores, but usage is not going above 37%
>
> Even much deeper down in program, much further down the line...
> And the location of segfault is random.
PS. line
[this](https://forum.dlang.org/thread/gomhpxzolddnodaeyvlh@forum.dlang.org) I am running into bus errors Too , sometimes way down the line after these foreach calls are completed...
More information about the Digitalmars-d-learn
mailing list