
"Christopher Kohlhoff" <chris@kohlhoff.com> wrote:
Yep, sorry I haven't replied to your related email on event throttling... still trying to catch up on digesting all the emails!
No problem. I was beginning to wonder if you are sleeping :)
I think this hard limit could be made configurable by adding a new class/service pair. E.g.:
template <typename Allocator = std::allocator<void> > class limits_service { ... };
template <typename Service> class basic_limits { public: basic_limits(demuxer_type& d); void post_queue(std::size_t value); std::size_t post_queue() const; ... and so on ... };
typedef basic_limits<limits_service<> > limits;
Usage:
boost::asio::demuxer d; boost::asio::limits l(d); l.post_queue(42);
That looks good to me.
Any suggestions about what sort of numbers should be used by default?
42 sounds good. :) My gut instinct would be to make it a multiple of the number of connections you intend to handle. Like num_connections * 5. The chance that there is 5 operations pending/connection is pretty unlikely. Usually there is at most 2. The I/O event and the timeout.