Subject: [Boost-bugs] [Boost C++ Libraries] #13567: io_context ::run() doesn't return immediately on stopped io_context due to Windows implementation
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2018-05-16 08:27:11
#13567: io_context ::run() doesn't return immediately on stopped io_context due to
Windows implementation
------------------------------------------------+--------------------------
Reporter: cvzakharchenko@⦠| Owner:
| chris_kohlhoff
Type: Bugs | Status: new
Milestone: To Be Determined | Component: asio
Version: Boost 1.67.0 | Severity: Problem
Keywords: windows, io_context, stop, stopped |
------------------------------------------------+--------------------------
This code hangs, when running on Windows:
{{{
boost::asio::io_context context; // 1
boost::asio::post(context, []() { for (;;); }); // 2
context.stop(); // 3
context.run(); // hangs in a handler,
posted in 2
}}}
[https://www.boost.org/doc/libs/1_67_0/doc/html/boost_asio/reference/io_context/stop.html
io_context::stop] documentation says:
Subsequent calls to run(), run_one(), poll() or poll_one() will return
immediately until restart() is called.
Which is, judging by example above, isn't true. Same goes for
[https://www.boost.org/doc/libs/1_67_0/doc/html/boost_asio/reference/io_context/stopped.html
io_context::stopped]:
When an io_context object is stopped, calls to run(), run_one(), poll()
or poll_one() will return immediately without invoking any handlers.
and code example below:
{{{
boost::asio::io_context context; // 1
boost::asio::post(context, []() { for (;;); }); // 2
context.stop(); // 3
if (context.stopped())
{
context.run(); // hangs in a handler,
posted in 2
}
}}}
When running on Linux, same code fully complies the documentation and
doesn't invoke any handlers in examples provided.
-- Ticket URL: <https://svn.boost.org/trac10/ticket/13567> 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 : 2018-05-16 08:32:10 UTC