【发布时间】:2012-02-23 02:17:52
【问题描述】:
当我在System.Threading.Tasks 命名空间中使用Parallel.ForEach 或Parallel.For 时,我可以假设所有线程在继续执行之前都已同步吗?
有没有类似的东西
WaitHandle.WaitAll(...);
继续?
所以如果我调用类似的东西
Parallel.ForEach(collection, DoSomethingWithObject);
我能否确定每次对DoSomethingWithObject 的调用都已完成在ForEach 返回之前,还是我需要自己使用WaitHandles?
【问题讨论】:
标签: c# .net multithreading task