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

2019-03-18 15:18发布

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.

2条回答
成全新的幸福
2楼-- · 2019-03-18 16:09

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.

查看更多
何必那么认真
3楼-- · 2019-03-18 16:09

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

查看更多
登录 后发表回答