title: Creating a thread for running io_service
body: <p>Consider the chat example at : <a href="http://www.boost.org/doc/libs/1_45_0/doc/html/boost_asio/examples.html" rel="nofollow noreferrer">http://www.boost.org/doc/libs/1_45_0/doc/html/boost_asio/examples.html</a></p>
  
  <p>Look the client  file : <a href="http://www.boost.org/doc/libs/1_45_0/doc/html/boost_asio/example/chat/chat_client.cpp" rel="nofollow noreferrer">http://www.boost.org/doc/libs/1_45_0/doc/html/boost_asio/example/chat/chat_client.cpp</a></p>
  
  <p>Here, seems like the point at which boost thread which runs the io_service is important..</p>
  
  <pre><code>chat_client c(io_service, iterator);
  
  boost::thread t(boost::bind(&amp;boost::asio::io_service::run, &amp;io_service));
  </code></pre>
  
  <p>If I create the thread before I create an object of chat_client, then the io_service.stopped() returns true if printed in the while loop below that.</p>
  
  <p>I do not understand why it is so?</p>