开发者

Can I share boost::asio::tcp::socket object between 2 threads that perform read and write

I have two threads, one sending and another r开发者_运维技巧eceiving data via TCP socket. I use boost::asio::read() and boost::asio::write() for reading and writing. My question is do I have to guard the access to socket object during read and write operation?

The other case would be what if I have two threads both writing using the same socket object?


The socket is not thread safe when shared between two or more threads. For more information look at the Boost.Asio documentation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜