![]() |
Boost : |
From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2007-05-22 07:18:44
On Mon, 21 May 2007 16:37:28 +0530, Gaurav.Jain_at_[hidden] said:
> Hi,
>
> 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.
It's worth noting that this is not the only way to do clean shutdown.
The new HTTP server examples ("server2" and "server3") also perform a
clean shutdown. However, rather than explicitly closing the connections,
they simply rely on the fact that the io_service destructor will destroy
all handler objects associated with unfinished operations.
> 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 :
[...]
> scheduler.stop();
What is scheduler? Is it an io_service? If so, by explicitly stopping it
some of your completion handlers will never be called. If you want to
use this particular clean shutdown design, it is better to wait for the
io_service::run() call to finish automatically once all the outstanding
operations have finished.
Cheers,
Chris
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk