是不是同步调用只是一个小的超时值的异步调用? [英] Isn't a synchronous call just an asynchronous call with a small timeout value?

查看:86
本文介绍了是不是同步调用只是一个小的超时值的异步调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有点困惑,为什么一个同步调用是一个异步调用不同的,因为从来就没有一个立竿见影的响应,它仍然需要一些纳米或毫秒?

I am a bit confused as to why a synchronous call is different to an asynchronous call, as there is never an "immediate" response, it still takes some nano or milliseconds?

推荐答案

一个同步调用返回到它的调用者在完成自己的工作(或达到超时)之后。异步调用后立即返回的启动的其他一些活动。

A synchronous call returns to its caller after finishing its job (or reaching timeout). An asynchronous call returns immediately after starting some other activity.

这意味着,对于同步调用,调用者等待 - 被完全阻塞 - 而所谓的活动情况;异步调用虽然这发生的一切就是活性的启动的几乎立即返回给调用者。其结果是,一个异步呼叫后,被叫活性在平行于呼叫活动运行

This means that, for a synchronous call, the caller waits - is completely blocked - while the called activity happens; an asynchronous call returns almost immediately to the caller although all that's happened is that the activity was started. As a result, after an asynchronous call, the called activity runs in parallel to the calling activity.

有往往一些机制,为异步启动活动报到,它的完成,或者调用活动可能投票或以其他方式寻找异步任务完成的证据。

There's often some mechanism for the asynchronously started activity to "report back" that it's finished, or the calling activity may poll or otherwise look for evidence of completion of the asynchronous task.

这篇关于是不是同步调用只是一个小的超时值的异步调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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