阅读背景:

执行和生成子任务时的结果不一致

来源:互联网 

I have some simple code in which the main Thread is creating a new Task. The task in turn spawns multiple child tasks. The main Thread does a 'wait' on the parent Task. I'm observing that I don't get the same output across multiple runs of the program. In the code below I'm printing out the value of the iteration variable in each task but across different runs only subsets get printed out. I understand that the execution is not ordered but it would still have to be complete in that I'm expecting 100 numbers to get printed out(in no particular order). Does calling Wait does not wait for all child tasks to complete? I'm running VS2010 Team system Beta1I have some simple code in which the main Threa




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: