Boost C++ Libraries: Ticket #5756: read_some() with null_buffers blocks in non-blocking mode https://svn.boost.org/trac10/ticket/5756 <p> I want to poll socket for readability (the same as calling POSIX poll or select with zero timeout), to just know if it is readable: </p> <ol><li>call sock.non_blocking(true) </li><li>call read_some with null_buffers() </li><li>it blocks </li></ol><p> If I change null_buffers() to some read buffer, all works fine, would_block error is returned. The correct behaviour, I think, is to return immediately with corresponding error (no error if socket is readable, would_block if it is not). </p> <p> At least tcp socket and posix::stream_descriptor are affected, not tested for other sockets. Also not tested write_some(), not sure if it is affected. </p> <p> test program attached </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5756 Trac 1.4.3 Gennady Proskurin <gpr@…> Fri, 05 Aug 2011 13:42:28 GMT attachment set https://svn.boost.org/trac10/ticket/5756 https://svn.boost.org/trac10/ticket/5756 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">sd.cc</span> </li> </ul> Ticket chris_kohlhoff Sat, 08 Oct 2011 21:15:46 GMT <link>https://svn.boost.org/trac10/ticket/5756#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5756#comment:1</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/74818" title="Make sure the synchronous null_buffers operations obey the user's ...">[74818]</a>) Make sure the synchronous null_buffers operations obey the user's non_blocking setting. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5756" title="#5756: Bugs: read_some() with null_buffers blocks in non-blocking mode (closed: fixed)">#5756</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>chris_kohlhoff</dc:creator> <pubDate>Sun, 09 Oct 2011 22:00:09 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/5756#comment:2 https://svn.boost.org/trac10/ticket/5756#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/74863" title="Merge from trunk... Fix compile error in regex overload of ...">[74863]</a>) Merge from trunk... </p> <p> Fix compile error in regex overload of async_read_until.hpp. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5688" title="#5688: Bugs: boost::asio::async_read_until with boost::regex compilation error (closed: fixed)">#5688</a> </p> <p> Explicitly specify the signal() function from the global namespace. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5722" title="#5722: Bugs: Compilation error when boost/signals.hpp is included before asio.hpp (closed: fixed)">#5722</a> </p> <p> Don't read the clock unless the heap is non-empty. </p> <p> Change the SSL buffers sizes so that they're large enough to hold a complete TLS record. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5854" title="#5854: Bugs: asio::ssl::stream holds last 16K until shutdown IF last buffer is on ... (closed: fixed)">#5854</a> </p> <p> Make sure the synchronous null_buffers operations obey the user's non_blocking setting. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5756" title="#5756: Bugs: read_some() with null_buffers blocks in non-blocking mode (closed: fixed)">#5756</a> </p> <p> Set size of select fd_set at runtime when using Windows. </p> <p> Disable warning due to const qualifier being applied to function type. </p> <p> Fix crash due to gcc_x86_fenced_block that shows up when using the Intel C++ compiler. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5763" title="#5763: Patches: Segmentation fault in ASIO signal handler (closed: fixed)">#5763</a> </p> <p> Specialise operations for buffer sequences that are arrays of exactly two buffers. </p> <p> Initialise all OpenSSL algorithms. </p> <p> Fix error mapping when session is gracefully shut down. </p> <p> Various performance improvements: </p> <ul><li>Split the task_io_service's run and poll code. </li></ul><ul><li>Use thread-local operation queues in single-threaded use cases (i.e. concurrency_hint is 1) to eliminate a lock/unlock pair. </li></ul><ul><li>Only fence block exit when a handler is being run directly out of the io_service. </li></ul><ul><li>Prefer x86 mfence-based fenced block when available. </li></ul><ul><li>Use a plain ol' long for the atomic_count when all thread support is disabled. </li></ul><ul><li>Allow some epoll_reactor speculative operations to be performed without holding the lock. </li></ul><ul><li>Improve locality of reference by performing an epoll_reactor's I/O operation immediately before the corresponding handler is called. This also improves scalability across CPUs when multiple threads are running the io_service. </li></ul><ul><li>Pass same error_code variable through to each operation's complete() function. </li></ul><ul><li>Optimise creation of and access to the io_service implementation. </li></ul><p> Remove unused state in HTTP server examples. </p> <p> Add latency test programs. </p> Ticket