【发布时间】:2014-10-11 06:57:59
【问题描述】:
在以下场景中:我们是否可以阻止主线程开始执行步骤 3,直到步骤 2 完成?
我说的是 C#
//step 1: some tasks
/*
*/
//step 2: perform some sub tasks in parallel.
Parallel.ForEach(X, x => Foo(x));
//step 3: Some other task
//Can we begin to perform step 3 until all sub tasks in step 2 finished???
【问题讨论】:
-
Parallel.ForEach将等待。
标签: c# multithreading parallel-processing