Boost C++ Libraries: Ticket #13358: boost::process on_exit fails when using multiple processes https://svn.boost.org/trac10/ticket/13358 <pre class="wiki">int main() { boost::asio::io_service ios; boost::asio::io_service::work working(ios); proc::child c1("/bin/sleep 1", ios, proc::on_exit=[](int exit, const std::error_code&amp; ec_in){std::cout&lt;&lt;"11111"&lt;&lt;std::endl;}); proc::child c2("/bin/sleep 4", ios, proc::on_exit=[](int exit, const std::error_code&amp; ec_in){std::cout&lt;&lt;"44444"&lt;&lt;std::endl;}); proc::child c3("/bin/sleep 2", ios, proc::on_exit=[](int exit, const std::error_code&amp; ec_in){std::cout&lt;&lt;"22222"&lt;&lt;std::endl;}); ios.run(); return 0; } </pre><p> prints </p> <pre class="wiki">22222 44444 11111 </pre><p> while it should prints 11111, 22222 and then 44444. However, 22222 is printed after 1 second, 44444 after 2s, and 11111 after 4s. </p> <p> The same error happen if you use: </p> <pre class="wiki"> boost::process::async_system(ios, [](boost::system::error_code, int){std::cout &lt;&lt; "11111" &lt;&lt; std::endl;}, "/bin/sleep 1"); </pre><p> This was observed on an up-to-date Archlinux (as of 2017-12-22) with gcc 7.2.1 and clang 5.0.0. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13358 Trac 1.4.3 david.glesser@… Fri, 22 Dec 2017 20:34:26 GMT <link>https://svn.boost.org/trac10/ticket/13358#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13358#comment:1</guid> <description> <p> I just noticed that this issue has already been reported on another issue tracker : <a class="ext-link" href="https://github.com/klemens-morgenstern/boost-process/issues/109"><span class="icon">​</span>https://github.com/klemens-morgenstern/boost-process/issues/109</a> . </p> </description> <category>Ticket</category> </item> </channel> </rss>