[Boost-bugs] [Boost C++ Libraries] #13337: io_service::stop() behavior on MSVC contradicts documentation

Subject: [Boost-bugs] [Boost C++ Libraries] #13337: io_service::stop() behavior on MSVC contradicts documentation
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-12-12 11:10:01


#13337: io_service::stop() behavior on MSVC contradicts documentation
----------------------------------------------+---------------------
 Reporter: Diego Barrios Romero <eldruin@…> | Owner: (none)
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: None
  Version: Boost 1.63.0 | Severity: Problem
 Keywords: |
----------------------------------------------+---------------------
 The io_service::stop() documentation says:
> [...] All invocations of this run() or run_one() member functions
 should return as soon as possible [...]

 This is the behavior observed on GCC but not on MSVC.

 Reproducer code:

 {{{
 #!cpp
 #include <boost/asio.hpp>
 #include <thread>
 #include <iostream>
 using namespace std::chrono_literals;

 int main() {
     boost::asio::io_service s;

     s.post([] { std::this_thread::sleep_for(5ms); std::cout << "1\n"; });
     s.post([] { std::this_thread::sleep_for(5ms); std::cout << "2\n"; });
     s.post([] { std::this_thread::sleep_for(5ms); std::cout << "3\n"; });

     std::thread th([&] { s.run(); });

     std::this_thread::sleep_for(1ms);
     s.stop();

     th.join();
 }
 }}}

 This prints "1" on [https://wandbox.org/permlink/N02wy78yFGX1eJRl GCC] but
 "1 2 3" on [http://rextester.com/FHNW43260 MSVC]

 This bug was concretized by an Stack Overflow user while he investigated
 #13317.
 See [https://stackoverflow.com/a/47733861/4999407 his answer] for more
 information.

-- 
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13337>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-12-12 11:16:43 UTC