Does boost::asio::io_service preserve the order of handlers?

余生长醉 提交于 2019-12-20 18:30:48

问题


Does boost::asio::io_service guarantee that handlers are called in the same order that they are given via post()? I can't find anything saying this in the documentation. Assume that calls to io_service::post are serialized.


回答1:


The current implementation does execute things in the sequence you post them, but ordering is only guaranteed for handlers that are explicitly post()ed through a strand.




回答2:


afaik if you want guaranteed ordering of post handler execution you have to use strand as described in the docs.



来源:https://stackoverflow.com/questions/6442812/does-boostasioio-service-preserve-the-order-of-handlers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!