Example #1
0
  /// Start an io_service.
  void start_one(io_service_ptr io_service)
  {
    // Reset the io_service in preparation for a subsequent run() invocation.
    io_service->reset();

    // Give the io_service work to do so that its run() functions will not
    //   exit until work was explicitly destroyed.
    work_.push_back(work_ptr(new boost::asio::io_service::work(*io_service)));

    // Create a thread to run the io_service.
    threads_.push_back(thread_ptr(new boost::thread(boost::bind(&io_service_pool::run_service,
                                                                this,
                                                                io_service))));
  }