internal static void ParallelFor <T>(T[] sources, Action <T> action) { Thread[] array = new Thread[Environment.ProcessorCount]; NativeCompiler.Counter parameter = new NativeCompiler.Counter(); for (int i = 0; i < array.Length; i++) { array[i] = new Thread(delegate(object obj) { NativeCompiler.Counter counter = (NativeCompiler.Counter)obj; int num; while ((num = Interlocked.Increment(ref counter.index)) <= sources.Length) { action(sources[num - 1]); } }); } Thread[] array2 = array; for (int j = 0; j < array2.Length; j++) { Thread thread = array2[j]; thread.Start(parameter); } Thread[] array3 = array; for (int k = 0; k < array3.Length; k++) { Thread thread2 = array3[k]; thread2.Join(); } }
internal static void ParallelFor <T>(T[] sources, Action <T> action) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type NativeCompiler.\u003CParallelFor\u003Ec__AnonStorey70 <T> forCAnonStorey70 = new NativeCompiler.\u003CParallelFor\u003Ec__AnonStorey70 <T>(); // ISSUE: reference to a compiler-generated field forCAnonStorey70.sources = sources; // ISSUE: reference to a compiler-generated field forCAnonStorey70.action = action; Thread[] threadArray = new Thread[Environment.ProcessorCount]; NativeCompiler.Counter counter = new NativeCompiler.Counter(); for (int index = 0; index < threadArray.Length; ++index) { // ISSUE: reference to a compiler-generated method threadArray[index] = new Thread(new ParameterizedThreadStart(forCAnonStorey70.\u003C\u003Em__F6)); } foreach (Thread thread in threadArray) { thread.Start((object)counter); } foreach (Thread thread in threadArray) { thread.Join(); } }