Boost logo

Boost :

Subject: Re: [boost] [ASIO] Having a hard time after upgrading my boost
From: Gaetano Mendola (mendola_at_[hidden])
Date: 2013-05-20 15:58:48


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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk