gpt4 book ai didi

c++ - 多次调用 async_accept

转载 作者:行者123 更新时间:2023-11-28 07:05:21 25 4
gpt4 key购买 nike

可以打电话吗async_accept在调用前一个调用的处理程序之前再次调用。

谢谢。

最佳答案

来自 async_accept 的文档:

Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using boost::asio::io_service::post().

io_service 有一个回调队列,将独立于 async_accept 中发生的事情进行处理。所以,是的,您可以多次调用它,每次它都会将您对处理程序的调用排队,然后 io_service 会将它们从队列中拉出并执行您的处理程序。

关于c++ - 多次调用 async_accept,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21846551/

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