View source code
Display the source code in std/parallelism.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Function std.parallelism.parallel
Convenience functions that forwards to taskPool
. The
purpose of these is to make parallel foreach less verbose and more
readable.
ParallelForeach!R parallel(R)
(
R range
);
ParallelForeach!R parallel(R)
(
R range,
size_t workUnitSize
);
Example
// Find the logarithm of every number from
// 1 to 1_000_000 in parallel, using the
// default TaskPool instance.
auto logs = new double[1_000_000];
foreach (i, ref elem; parallel(logs))
{
elem = log(i + 1.0);
}
Authors
License
Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.