09 2014 档案

摘要:之前看了园子里的一篇文章「async & await的前世今生」,收益颇多。而其中有句话被博主特意用红色标注,所以留意多看了几眼,「await 之后不会开启新的线程(await 从来不会开启新的线程)」。在MSDN上找到的相关资料也佐证了其正确性——The async and await keywords don't cause additional threads to be created. Async methods don't require multithreading because an async method doesn't run on its own thread. The method runs on the current synchronization context and uses time on the thread only when the method is active.(async 和 await 关键字不会导致创建其他线程。 因为异步方法不会在其自身线程上运行,因此它不需要多线程。 只有当方法处于活动状态时,该方法将在当前同步上下文中运行并 阅读全文
posted @ 2014-09-01 12:24 申江渔夫 阅读(6420) 评论(10) 推荐(3) 编辑