public static void ContextTest() { Random rnd = new Random(); WorkItem[] sourceData = new WorkItem[10000]; for (int i = 0; i < sourceData.Length; i++) { sourceData[i] = new WorkItem() { WorkDuration = rnd.Next(1, 11) }; } WorkItem[] resultData = new WorkItem[sourceData.Length]; OrderablePartitioner <WorkItem> cPartitioner = new ContextPartitionerII(sourceData, 100); Parallel.ForEach(cPartitioner, (WorkItem item, ParallelLoopState loopState, long index) => { item.performWork(); resultData[index] = item; }); }
public EnumerableSource(ContextPartitionerII parent) { parentPartitioner = parent; }
public ChunkEnumerator(ContextPartitionerII parent) { parentPartitioner = parent; }