I am compiling the boost::asio example: http://www.boost.org/doc/libs/1_46_1/doc/html/boost_asio/examples.html#boost_asio.examples.http_server_3
It is supposed to be a multi-threaded server implementation.
Now, in the async_read handler I print a message and sleep for 30 seconds. I open localhost in two browsers and see that handle_read is called once, then 30 seconds nothing happens and finally handle_read is called for the second time.
The io_Service.run is called with 5 threads.
Why aren't the handlers called concurrently? e.g. why does it wait for the first handle_read to finish before calling the second?
new_connection_->start();is called for every new connection, which calls async_read, then async_accept is called to wait for another connection. In handle_read (registered by async_read), the request is processed and after that async_read is called again to register handle_read. So the calls are made independently in two sockets. - thelamb