Boost logo

Boost Users :

Subject: [Boost-users] Is boost::asio::ip::tcp::iostream thread safe?
From: boost (boost_at_[hidden])
Date: 2012-05-10 04:08:04



hi all,

I use ip::tcp::iostream but I don't know if it is thread safe, and I cannot find the answer in boost document. 

I read from ip::tcp::iostream in the receiver thread, and send request in another thread. 
Now I protected the stream with a mutex. But the problem is that, if I do not send request, the server will not response, 
and the receiver will block on read with lock, and the sender cannot hold the lock and cannot send the request, deadlock.


Is there anyone know that? Please kindly give me an answer.

Best Regards
Zhanwei Wang

hi all,

I use ip::tcp::iostream but I don't know if it is thread safe, and I cannot find the answer in boost document.

I read from ip::tcp::iostream in the receiver thread, and send request in another thread.
Now I protected the stream with a mutex. But the problem is that, if I do not send request, the server will not response,
and the receiver will block on read with lock, and the sender cannot hold the lock and cannot send the request, deadlock.

Is there anyone know that? Please kindly give me an answer.

Best Regards
Zhanwei Wang


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net