On Friday, 25 June 2021 at 13:53:17 UTC, seany 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)) {
                  //....
                }


A self-contained and complete example would help a lot, but the likely
problem with this code is that you're accessing pnts[y][x] in the
loop, which makes the loop bodies no longer independent because some
of them need to first allocate an int[] to replace the zero-length
pnts[y] that you're starting with.

Consider:

```
$ rdmd --eval 'int[][] p; p.length = 5; p.map!"a.length".writeln'
[0, 0, 0, 0, 0]
```

Reply via email to