Subject: [Boost-bugs] [Boost C++ Libraries] #3627: boost::asio::async_read() cannot be used with null_buffers()
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-11-16 09:55:23
#3627: boost::asio::async_read() cannot be used with null_buffers()
----------------------------------------------------------------+-----------
Reporter: Dmitry Goncharov <dgoncharov@â¦> | Owner: chris_kohlhoff
Type: Bugs | Status: new
Milestone: Boost 1.41.0 | Component: asio
Version: Boost 1.40.0 | Severity: Problem
Keywords: asio async_read null_buffers |
----------------------------------------------------------------+-----------
An attempt to use async_read() with null_buffers() causes the handler to
be invoked even when the underlying file descriptor is not yet available
for reading.
The following test demonstrates the problem
void test_async_read()
{
struct local
{
static void on_ready(boost::system::error_code const& error, int*
invoked)
{
BOOST_CHECK(!error);
*invoked = 1;
}
};
int p[2];
int const s = pipe(p);
BOOST_CHECK(0 == s);
boost::asio::io_service ios;
boost::asio::posix::stream_descriptor sd(ios, p[0]);
ios.reset();
int invoked = 0;
boost::asio::async_read(sd, boost::asio::null_buffers(),
boost::bind(&local::on_ready, _1, &invoked));
ios.poll_one();
BOOST_CHECK(!invoked); // doesn't pass
}
This test doesn't pass on linux using either epoll or select multiplexing
mechanism. This test also doesn't pass on freebsd using either kqueue or
select multiplexing mechanism.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3627> 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-02-16 18:50:01 UTC