Boost logo

Boost Users :

Subject: Re: [Boost-users] blocking read after async connect
From: Igor R (boost.lists_at_[hidden])
Date: 2010-03-22 05:39:32


> I find that unless I call io_service::stop() , I can't perform a asio::read().
> It's actually on a thread and I'm having difficulty seeing what the
> exception thrown exactly is ('thread called terminate')

Use your own thread function to see what happened to your io_service:

void do_run(io_service *io)
{
  try
  {
    io->run();
    std::cout << "io_service::run ended" <<std::eol;
  }
  catch(std::exception &e)
  {
    std::cout << e.what() <<std::eol;
  }
  catch(...)
  {
    std::cout << "some other exception" <<std::eol;
  }
}

//...
thread t(&do_run, &io_service);


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net