在以下情況下:我們是否可以阻止主線程開始執行第3步,直到第2步完成?
我說的是C#Parallel.ForEach:如何阻止主線程,直到完成所有並行任務
//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'將等待。 – Ofiris 2014-10-11 07:01:43