Boost logo

Boost :

Subject: [boost] [asio] ip::tcp::socket thread safety
From: Gaetano Mendola (mendola_at_[hidden])
Date: 2012-04-02 11:07:54

Hi all,
reading the manual I see that ip::tcp::socket thread safety on shared object is not safe.

In my application I'm using:

boost::asio::async_read( ip::tcp::socket , ...)

the application queue an async_read or an async_connect inside
the receiving handler (in case of error it retry the connection).

>From an external thread (to stop the reception) I perform a:


do I have realy to synchronize the async_connect/async_read with
shutdown/close ?

Using a mutex to protect those calls seems an overkill, may be shutdown
and close can be called in concurrency with async_connect/async_read and the
documentation is just conservative?

Gaetano Mendola

Boost list run by bdawes at, gregod at, cpdaniel at, john at