How to call stop from parallel foreach

seany seany at uni-bonn.de
Thu Jun 24 18:23:01 UTC 2021


I have seen 
[this](https://forum.dlang.org/thread/akhbvvjgeaspmjntznyk@forum.dlang.org).

I can't call break form parallel foreach.

Okey, Is there a way to easily call .stop() from such a  case?

Here is a case to consider:

     outer: foreach(i, a; parallel(array_of_a)) {
        foreach(j, b; parallel(array_of_b)) {
          auto c = myFunction0(i,j);
          auto d = myFunction1(a,b);
          auto f = myFunction2(i,b);
          auto g = myFunction3(a,j);

          if(someConditionCheck(c,d,f,g)) {
            // stop the outer foreach loop here
          }

        }
     }

Thank you


More information about the Digitalmars-d-learn mailing list