Boost logo

Boost Users :

From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2006-10-26 17:49:46


Hi George,

george wrote:
> At the moment I use the async_* functions and my threads are
> call the io_service::run() method. My application is
> thread-safe, for asio is there any detail I should take care
> when I call io_service:run() from many threads?

The io_service::run() function is designed to support being
called from multiple threads, so you don't need to do anything
special in that part of your application.

However, if you call io_service::run() from multiple threads
then it's possible for several of your callback handlers to be
executed concurrently. If you have handlers that you do not want
running concurrently (e.g. all handlers associated with a single
connection object) you may want to look at using a strand:

http://asio.sourceforge.net/boost_asio_0_3_7/libs/asio/doc/tutorial/tuttimer5.html

Cheers,
Chris


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