如何异步伺机不阻止? [英] How does async-await not block?

查看:112
本文介绍了如何异步伺机不阻止?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收集的异步方法是良好的IO工作,因为它们不会阻塞线程,同时他们正等待着,这是怎么回事实际上可能吗?我认为有些事情是听来触发完成任务,那么,这是否意味着阻塞刚搬到别的地方?

I gather that the async methods are good for IO work because they don't block the thread whilst they're being awaited, but how is this actually possible? I assume something has to be listening to trigger the task to complete, so does this mean that the blocking is just moved somewhere else?

推荐答案

没有,阻塞不动其他任何地方。返回awaitable类型BCL方法使用技术,如用一个完全异步的经验I / O完成端口重叠I / O。

No, the blocking is not moved anywhere else. BCL methods that return awaitable types use techniques such as overlapped I/O with I/O completion ports for a fully asynchronous experience.

我有一个最近的博客帖子描述这是如何工作的所有方式,以物理设备和背部。

I have a recent blog post that describes how this works all the way down to the physical device and back.

这篇关于如何异步伺机不阻止?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆