
Sean McAllister wrote:
The only functions I'm binding with boost::bind are members of ClassifierContext, eg:
ICMessage::async_read(socket_,
boost::bind(&ClassifierContext::handleCmdMsg,
this, _1,_2,_3));
Since the io_service object is stopped in the destructor of ClassifierContext, shouldn't that be OK? Or should I still try to create a shared_from_this off of the ClassifierContext class?
Not sure, given you are running multiple threads. According to the documentation, io_service::stop() doesn't block, so it could still be needing the shared_from_this stuff. Another approach is to allocate the work object in your member io_loop of ClassifierContext, and in the destructor, do something like m_work_ptr.reset(); ioService_.run(); this makes sure all outstanding operations are finished. Cheers, Rutger