Why do I need strand per connection when using boost::asio?

前端 未结 2 634
予麋鹿
予麋鹿 2020-11-22 01:43

I\'m reviewing HTTP Server 3 example on Boost\'s website.

Could you guys please explain why I need strand per connection ? As I can see we call re

2条回答
  •  醉酒成梦
    2020-11-22 02:32

    I believe it is because the composed operation async_write. async_write is composed of multiple socket::async_write_some asynchronously. Strand is helpful to serialize those operations. Chris Kohlhoff, the author of asio, talks about it briefly in his boostcon talk at around 1:17.

提交回复
热议问题