How to break from parallel foreach?
Russel Winder
russel at winder.org.uk
Wed Feb 27 07:24:35 UTC 2019
On Tue, 2019-02-26 at 19:58 +0000, Andrey via Digitalmars-d-learn wrote:
> Hello,
> How to break from parallel foreach?
> More general question - how to control such loop?
It is not clear to me that the concept of "breaking" from a parallel loop
makes sense.
For a sequential loop each loop body is executed one after the other, and so
the concept of "break" makes some sort of sense as an early exit.
For a parallel loop, each loop body is (at least conceptually) executed at the
same time, there is no sequential activity, thus no relevance of "break". A
parallel for is really a scatter of all the loop bodies which then execute,
and then there is a gather, and maybe even a reduction. The notion of "break"
seems to have no meaning in such a computation.
--
Russel.
===========================================
Dr Russel Winder t: +44 20 7585 2200
41 Buckmaster Road m: +44 7770 465 077
London SW11 1EN, UK w: www.russel.org.uk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20190227/207563d5/attachment.sig>
More information about the Digitalmars-d-learn
mailing list