One of the first loops that any programmer becomes familiar with is the for loop. In this recipe, we'll see a particular type of for loop—the parallel one. To be clear, this parallel for loop is not a new language feature, but is kind of implemented as a static class method.
The parallel for loop is part of the Parallel Programming Library, and is implemented by the TParallel class. Here's one of its (overloaded) versions and a utilization example:
//declaration
class method TParallel.&For(ALowInclusive, AHighInclusive:
Integer; const AIteratorEvent: TProc<Integer>): TLoopResult;
//used as follows
TParallel.&For(1,10,
procedure(Index: Integer)
begin
//executed 10 times with index 1..10
end);
What is different about the classic for? The difference is...