|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r54845 - trunk/boost/asio/detail
From: chris_at_[hidden]
Date: 2009-07-09 18:58:26
Author: chris_kohlhoff
Date: 2009-07-09 18:58:26 EDT (Thu, 09 Jul 2009)
New Revision: 54845
URL: http://svn.boost.org/trac/boost/changeset/54845
Log:
Don't write to /dev/poll descriptor when there are no pending changes.
Text files modified:
trunk/boost/asio/detail/dev_poll_reactor.hpp | 29 ++++++++++++++++-------------
1 files changed, 16 insertions(+), 13 deletions(-)
Modified: trunk/boost/asio/detail/dev_poll_reactor.hpp
==============================================================================
--- trunk/boost/asio/detail/dev_poll_reactor.hpp (original)
+++ trunk/boost/asio/detail/dev_poll_reactor.hpp 2009-07-09 18:58:26 EDT (Thu, 09 Jul 2009)
@@ -366,23 +366,26 @@
// Write the pending event registration changes to the /dev/poll descriptor.
std::size_t events_size = sizeof(::pollfd) * pending_event_changes_.size();
- errno = 0;
- int result = ::write(dev_poll_fd_,
- &pending_event_changes_[0], events_size);
- if (result != static_cast<int>(events_size))
+ if (events_size > 0)
{
- for (std::size_t i = 0; i < pending_event_changes_.size(); ++i)
+ errno = 0;
+ int result = ::write(dev_poll_fd_,
+ &pending_event_changes_[0], events_size);
+ if (result != static_cast<int>(events_size))
{
- int descriptor = pending_event_changes_[i].fd;
- boost::system::error_code ec = boost::system::error_code(
- errno, boost::asio::error::get_system_category());
- read_op_queue_.perform_all_operations(descriptor, ec);
- write_op_queue_.perform_all_operations(descriptor, ec);
- except_op_queue_.perform_all_operations(descriptor, ec);
+ for (std::size_t i = 0; i < pending_event_changes_.size(); ++i)
+ {
+ int descriptor = pending_event_changes_[i].fd;
+ boost::system::error_code ec = boost::system::error_code(
+ errno, boost::asio::error::get_system_category());
+ read_op_queue_.perform_all_operations(descriptor, ec);
+ write_op_queue_.perform_all_operations(descriptor, ec);
+ except_op_queue_.perform_all_operations(descriptor, ec);
+ }
}
+ pending_event_changes_.clear();
+ pending_event_change_index_.clear();
}
- pending_event_changes_.clear();
- pending_event_change_index_.clear();
int timeout = block ? get_timeout() : 0;
wait_in_progress_ = true;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk