title: boost::asio::io_service run() returning despite work assigned?
body: <p>Having read up on Boost.Asio tutorials and documentation, it seems to me that the following main() function should not return:</p>
  
  <pre><code>#include &lt;boost/asio.hpp&gt;
  
  int main()
  {
      boost::asio::io_service io_service;
      boost::asio::io_service::work work(io_service);
  
      boost::system::error_code ec;
      io_service.run(ec);
  
      std::cout &lt;&lt; ec.value() &lt;&lt; " - " &lt;&lt; ec.message() &lt;&lt; std::endl;
  
      return 0;
  }
  </code></pre>
  
  <p>I've assigned it work and expect run() to block until the work is destroyed - which in this minimum viable demonstration doesn't happen until after run() returns.</p>
  
  <p>However, the program returns immediately, displaying "0 - Success". That seems wrong.</p>
  
  <p>I've encountered this after having tried a more complicated example using io_service.run() within a separate thread, and that also didn't work as expected. So a special case for detecting and avoiding deadlock situations seems unlikely.</p>
  
  <p>Am I doing something fundamentally wrong? Is this a bug in Ubuntu's (14.04) Boost libraries? Any idea on how to debug or find out what the problem is?</p>