title: Example of dynamic thread pool in boost::asio
body: <p>I'm going to implement boost::asio server with a thread pool using single <code>io_service</code> ( <a href="http://www.boost.org/doc/libs/1_45_0/doc/html/boost_asio/examples.html" rel="noreferrer">HTTP Server 3
  example</a> ). <code>io_service</code> will be bound to unix domain socket and pass requests going from connections on this socket to different threads. In order to reduce resource consumption I want to make the thread pool dynamic. </p>
  
  <p>Here is a concept. Firstly a single thread is created. When a request arrives and server sees that there is no idle thread in a pool it creates a new thread and passes the request to it. The server can create up to some maximum number of threads. Ideally it should have functinality of suspending threads which are idle for some time.</p>
  
  <p>Did somebody make something similar? Or maybe somebody has a relevant example? </p>
  
  <p>As for me, I guess I should somehow override <code>io_service.dispatch</code> to achieve that.</p>