The FindPrimeGroupsInParallel method is the heart of the ParallelPrimesTuple example solution. Like the preceding solution, this solution uses form-level variables to allow different instances of the parallel method to share the same values. The following code shows this example's variable declarations:
// Parameters used by parallel method CheckForGroupsInParallel.private const int NumValuesPerBatch = 10000;private object ParallelMaxLockObject = new object();private List<List<int>> ParallelGroups = null;private int ParallelMax = -1;private int ParallelSpacing = -1;private int ParallelNumPerGroup = -1;private bool[] ParallelIsPrime = null;
Most of these values are used by the CheckForGroupsInParallel method to look ...