On 20/05/2013 15.42, Marat Abrarov wrote:
Also note that most of Asio classes (sockets, timers, etc.) are not thread safe. So in multi-threaded program you have to use some kind of synchronization if there is no implicit strand (http://www.boost.org/doc/libs/1_53_0/doc/html/boost_asio/overview/core/stra nds.html).
The fact that sockets are not thread safe and the usage of strand is something no related each other. The fact that ip::tcp::socket are not thread safe imply that you can not use the same instance from multiple threads (two concurrent async operation calls for example). Some time you can not have concurrent handlers calls, so if you have a pool of threads calling the io_service::run() you have to use io_service::strand to serialize handler execution. Regards Gaetano Mendola