I\'m trying to implement the Parallel.ForEach pattern and track progress, but I\'m missing something regarding locking. The following example counts to 1000 whe
Parallel.ForEach
Remove lock statements from properties and modify Main body:
object sync = new object(); Parallel.ForEach(ids, new ParallelOptions {MaxDegreeOfParallelism = threadCount}, id => { lock(sync) progress.CurrentCount++; });