I would like to use `boost::asio` to set up a thread pool.
My question is : how can I attach specific data to each of the threads created, and how can I manage individual outputs ?

To be more specific, I wrote a class `Simulation` which performs the simulation via a method taking some parameters in input.
This class contains all the data needed for the calculation.
As the data is not too big, I would like to duplicate it in order to use a different instance of the class `Simulation` in each thread of the pool.

I would like to do something like this : 
(Setting up a thread pool is explained here : [SO](https://stackoverflow.com/questions/7957059/boostasio-io-service-thread-pool) and [Asio recipes](http://think-async.com/Asio/Recipes?skin=clean.nat,asio,pattern#A_thread_pool_for_executing_arbi))

```
class ParallelSimulation
{
  public:
    static const std::size_t N = 10;

  protected:
    std::vector< boost::shared_ptr<Simulation> > simuInst; // N copy of a reference instance.

  public:

    ...

    // Simulation with a large (>>N) number of inputs
    void eval( std::vector< SimulationInput > inputs )
    {
      // Creation of the pool using N threads
      asio::io_service io_service;
      asio::io_service::work work(io_service);
      boost::thread_group threads;
      for (std::size_t i = 0; i < N; ++i)
        threads.create_thread(boost::bind(&asio::io_service::run, &io_service));

      // Here ? Attaching the duplicates instances of class Simulation ?

      // Adding tasks
      for( std::size_t i = 0, i_end = inputs.size(); i<i_end; ++i)
        io_service.post(...); // add simulation with inputs[i] to the queue

      // How to deal with outputs ?  

      // End of the tasks
      io_service.stop();
      threads.join_all();
    }
};

```

Maybe the technique used to set up a thread pool (using `boost::asio`) is not adapted to my problem. Would you have any suggestions ?
Thanks.