I have difficulty to understand loopState.Stop() and loopState.Break(). I have read MSDN and several posts about it but I am still confused.
What I understand is that every iteration partitioner gives remaining indexes for threads to process and loopState.Stop() stops all threads and loopState.Break() stops the current thread.
However lets consider the following situation:
Parallel.For(0, 100, (i, loopState) =>
{
if (i >= 10)
loopState.Break();
Debug.Write(i);
});
For this loop I have following result:
0 25 1 2 3 4 5 6 7 8 9 10
I have no idea why in the result there is 10 and 25 numbers.
Anyone can help?
P.S. I have i5 520M CPU (2 cores => 4 Threads)
image ref: 