
6 Oct
2011
6 Oct
'11
10:30 a.m.
Hi, Christopher.
Since the callback never happens, my instance never gets destroyed.
How do I effectively cancel any outstanding work the io_service has posted to it, such that the smart pointer in the function object that the bind created will lose its reference count?
You can destroy io_service instance. asio::io_service::~io_service destroys all callbacks. Another solution is to close acceptor (and all other instances of asio::basic_io_object related to io_service instance), call asio::io_service::reset() and clear all queued callbacks by running them (asio::io_service::run/poll etc). Regards, Marat Abrarov.