gpt4 book ai didi

windows - WinHttp : can it be used in parallel?

转载 作者:可可西里 更新时间:2023-11-01 11:49:53 24 4
gpt4 key购买 nike

我从 MSDN 看到以下内容:

WinHTTP is not reentrant except during asynchronous completioncallback. That is, while a thread has a call pending to one of theWinHTTP functions such as WinHttpSendRequest, WinHttpReceiveResponse,WinHttpQueryDataAvailable, WinHttpSendData, or WinHttpWriteData, itmust never call WinHTTP a second time until the first call hascompleted.

One scenario under which a second call could occur is asfollows: If an application queues an Asynchronous Procedure Call (APC)to the thread that calls into WinHTTP, and if WinHTTP performs analertable wait internally, the APC can run. If the APC routine happensalso to call WinHTTP, it reenters the WinHTTP API, and the internalstate of WinHTTP can be corrupted.

这是否意味着,当线程调用 WinHTTP 时,“线程本身”不能再调用 WinHTTP?

或者这是否意味着,当一个线程正在调用 WinHTTP 时,在您的整个程序中不能调用任何其他 WinHTTP(即使它们在其他线程中。)?

谁能解释一下我提供的 MSDN 示例?如果它处于同步模式,大多数 WinHTTP 功能都是阻塞的? APC怎么跑?

最佳答案

Does this mean, while a thread is calling WinHTTP, "the thread itself" can no longer call into WinHTTP?

是的。允许不同线程对 WinHTTP 进行并发调用。

关于windows - WinHttp : can it be used in parallel?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32669640/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com