Boost logo

Boost :

From: Gaurav.Jain_at_[hidden]
Date: 2007-05-21 07:07:28


I am using boost boost 1.33.1 with asio 0.3.8rc2. I have develop a
Multi-threaded server program using pool of io_service. In my design i
have pool of io_service object and this pool is controlled by a pool
manager, which is running over a seprate io_service. I want to do clean
shutdown of the server. In the clean shut down i want to close each
connection running over related io_service. What i am doing is, while
shutting down the server, pool manager is posting a request to each
io_service object to shut it down. Each io_service object in turn
posting a request to all the connection it is hosting to stop
themselves. The problem i am facing : connection stop method is not
getting executed at all for each running connection.

Here is a code snippet of what i am doing :

bool io_object_pool::shutdown_pool()
        std::vector<io_object*>::const_iterator iter_output =
        std::vector<io_object*>::const_iterator iter_end_output =

        for(; iter_output != iter_end_output; )
                io_object* io_object_temp = *iter_output;
        is_pool_destroyed = true;
        return true;

bool io_object::stop_all()
        std::set<connection_ptr >::const_iterator iter_output =
        std::set<connection_ptr >::const_iterator iter_end_output =

        for(; iter_output != iter_end_output;)
                connection_ptr conn_temp = *iter_output;
        return true;

bool tcp_connection::stop()

                std::cout << "tcp_connection stop called" << std::endl;

                assigned_io_object_->remove_request(); // remove the
//connection from the repository of connection managed by the
//related io service object

                assigned_io_object_ = NULL;
                is_connection_stop = true;
        catch (std::exception&)


        return true;

The message "tcp_connection stop called" is not getting called for each
of the io service. Any suggestion what might wrong in this case ? Or is
this still considered as a clean shutdown (tcp_connection::stop still
not getting execute for each of the connection).

Gaurav Jain

This message contains privileged and confidential information and is intended only for an individual named. If you are not the intended recipient, you should not disseminate, distribute, store, print, copy or deliver this message. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete or contain viruses. The sender, therefore, does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required, please request a hard-copy version.

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