title: Trouble with boost::bind and io_service
body: <p>Hi I'm currently trying to create a thread pool for a io_service object.</p>
  <p>I also found an example of how to do this (see there, example 1f: <a href="http://www.gamedev.net/blog/950/entry-2249317-a-guide-to-getting-started-with-boostasio?pg=2" rel="nofollow noreferrer">http://www.gamedev.net/blog/950/entry-2249317-a-guide-to-getting-started-with-boostasio?pg=2</a> )</p>
  <p>That example also works (of course) however I would rather try to keep the io_service non-global (which it is in the example). So now I have thought about trying to pass the io_service as an argument to the worker thread and therefore keep it &quot;internal&quot;.</p>
  <p>boost::thread_group doesn't seem to have support for passing arguments though (yet) so I tried to do it with boost::bind</p>
  <p>The result code looks something like this:</p>
  <pre><code>void workerThread(io_service service)
  {
      service.run();
  }
  
  void initListeners() //this function gets called in the main function
  {   
      io_service io_service;
      //we give the io_service something to work here
      boost::thread_group worker_threads;
  
      for(int i = 0; i &lt; 4; ++i)
          worker_threads.create_thread(boost::bind(workerThread, io_service));
  
      worker_threads.join_all();
  }
  </code></pre>
  <p>However when I try to compile this code he gives me the error</p>
  <blockquote>
  <p>error C2248: 'boost::noncopyable_::noncopyable::noncopyable' : cannot access private member declared in class 'boost::noncopyable_::noncopyable'</p>
  <p>This diagnostic occurred in the compiler generated function 'boost::asio::io_service::io_service(const boost::asio::io_service &amp;)'</p>
  </blockquote>
  <p>Does this mean I can't pass an io_service object as an argument at all?</p>
  <p>If yes then how can I do this thread pool without having the io_service as a global object?
  <br>
  If no then how would the solution for this problem look like with the above code?</p>