Boost C++ Libraries: Ticket #13317: io_service behaviour difference between ubuntu and msvc-14 https://svn.boost.org/trac10/ticket/13317 <p> When implementing a basic thread pool using boost::asio::io_service, I am observing some differences in how queued tasks are handled when stopping the io_service. </p> <p> On MSVC 14 (MS Visual Studio 2015), for some reason the queued tasks which were not started yet are not dropped when stopping the io_service but are run nonetheless. These tasks are dropped when running this on Ubuntu 16.04 (GCC 5.4.0). </p> <p> I have simplified and cleaned up the original tests and put them in a single file (attached) which only depends on boost and uses some sleeps to demonstrate the problem. You can build it with the CMakeLists.txt attached if you wish. </p> <p> The output on Ubuntu is as expected: </p> <pre class="wiki">checkAllWorkIsProcessedBeforeDestruction passed. passed. passed. checkWorkCanBeCancelled passed. passed. passed. checkWorkCanBeInterrupted passed. passed. passed. checkUninterruptableWorkIsNotInterruptedButCanBeDropped passed. passed. passed. passed. </pre><p> This is the output on MSVC 14: </p> <pre class="wiki">checkAllWorkIsProcessedBeforeDestruction passed. passed. passed. checkWorkCanBeCancelled Error: functor 1 call expected: false current: true Error: functor 2 call expected: false current: true Error: running time expected: 150 current: 402 checkWorkCanBeInterrupted passed. passed. passed. checkUninterruptableWorkIsNotInterruptedButCanBeDropped passed. Error: functor 2 call expected: false current: true passed. Error: running time expected: 250 current: 404 </pre><p> Am I doing something wrong? </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13317 Trac 1.4.3 Diego Barrios Romero <eldruin@…> Fri, 01 Dec 2017 16:56:57 GMT attachment set https://svn.boost.org/trac10/ticket/13317 https://svn.boost.org/trac10/ticket/13317 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">ThreadPoolTests.cpp</span> </li> </ul> <p> Test showing the problem </p> Ticket Diego Barrios Romero <eldruin@…> Fri, 01 Dec 2017 16:57:11 GMT attachment set https://svn.boost.org/trac10/ticket/13317 https://svn.boost.org/trac10/ticket/13317 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">CMakeLists.txt</span> </li> </ul> Ticket Diego Barrios Romero <eldruin@…> Tue, 12 Dec 2017 11:14:07 GMT <link>https://svn.boost.org/trac10/ticket/13317#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13317#comment:1</guid> <description> <p> I have reported the underlying bug on <a class="new ticket" href="https://svn.boost.org/trac10/ticket/13337" title="#13337: Bugs: io_service::stop() behavior on MSVC contradicts documentation (new)">#13337</a>, found after further investigation. This bug should be closed as the code is more complicated and contains a race. </p> </description> <category>Ticket</category> </item> </channel> </rss>