[Boost-bugs] [Boost C++ Libraries] #9325: io_service.poll_many

Subject: [Boost-bugs] [Boost C++ Libraries] #9325: io_service.poll_many
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-10-30 17:49:56


#9325: io_service.poll_many
-------------------------------------+----------------------------
 Reporter: edubart <edub4rt@…> | Owner: chris_kohlhoff
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: asio
  Version: Boost Development Trunk | Severity: Cosmetic
 Keywords: |
-------------------------------------+----------------------------
 I use boost::asio for working in a single thread application which
 downloads data using asio sockets, this application has a main polling
 function that calls io_service.poll and call other polls. This poll
 function needs to run and return immediately, however
 boost::asio::io_service.poll() doesn't return immediately in the following
 case:

 If my app have sockets transfering data too fast (e.g: downloading from
 localhost), new tasks added to io_service, are dispatched in the running
 io_service.poll() call (even when added via io_service.post()). So in
 summary if I am downloading 1GB of data from localhost, the
 async_read/async_write handlers of the all the data will be dispatched in
 one boost::asio::io_service.poll(), and may take minutes. My current
 workaround is to run another thread to call io_service.stop() after a
 timeout, however I want to request a new polling function to simplify this
 case:

 {{{
 /// Run the io_service object's event processing loop to execute up to max
 ready handlers
 /**
  * The poll_many() function runs handlers that are ready to run, without
 blocking,
  * until max ready handlers were executed or the io_service has been
  * stopped or there are no more ready handlers or
  *
  * @param ec Set to indicate what error occurred, if any.
  *
  * @return The number of handlers that were executed.
  */
 std::size_t io_service.poll_many(std::size_t max,
 boost::system::error_code& ec)
 }}}

 This way I would be able to limit how many ready handlers would be
 executed, thus avoid blocking the main thread and remove the workaround
 thread.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9325>
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:14 UTC