参见英文答案 >
What happens while waiting on a Task’s Result?2个
@H_403_2@Task.Result是否同步阻止当前线程,以便它在等待任务完成时不能用于执行其他操作?
例如,如果我在ASP.NET执行路径中调用Task.Result,则当前线程在等待结果时不能用于处理其他请求.
顺便问一下,C#5.0中的异步怎么样?是否等待异步方法阻止当前线程?
谢谢你的评论.
解决方法
MSDN:
https://msdn.microsoft.com/en-us/library/dd321468(v=vs.110).aspx
Accessing the property’s get accessor blocks the calling thread until the asynchronous operation is complete; it is equivalent to calling the Wait method
MSDN:https://msdn.microsoft.com/en-us/library/hh156528.aspx
An await expression does not block the thread on which it is executing