apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ryan Bloom" <...@covalent.net>
Subject RE: New apr_poll() implementation was Re: [PATCH] speed up network timeout processing
Date Sat, 06 Jul 2002 15:32:18 GMT
> From: Justin Erenkrantz [mailto:jerenkrantz@apache.org]
> On Fri, Jul 05, 2002 at 08:47:32PM -0400, rbb@apache.org wrote:
> > This also creates a support library for APR, this is basically just
> > series of functions that APR can use internally to get the job
> > done.  Since wait_for_io_or_timeout was identical between files and
> > sockets, I have moved that function to the support lib, it also now
> > apr_poll().
> What's the rationale behind a 'support library' for APR?  All of the
> content in newpoll.tar.gz seems like it should just stay in APR.  You
> have me thoroughly confused here.  Perhaps in a new directory, but
> definitely not a separate library.

Support library may have been the wrong words.  It is just a set of
functions for use inside of APR that don't belong to any other category
of APR functions.  It is implemented as a directory inside of APR, but
the functions aren't meant to be used outside of APR.

> I'm also not clear what the additional num parameter to apr_poll is
> buying us.  Why not just use the *nsds value on input as your num
> parameter?  The number of descriptors read is what *nsds is on the
> output.  No signature change required.

Because if Apache can't get it right, then I am assuming that nobody
else can either.  I had originally coded it to use *nsds just as you
describe below, and it didn't pass any tests, because throughout the
code people were passing 0 as *nsds.  I decided to fix an API problem
that I created years ago by using the same variable for both input and
output parameters in this patch.  I am not tied to adding num, but I do
believe that it is the correct approach.

> So, why not do something like this (very rough):
> (Some OS does the low magic number off the stack, but I can't
> remember which for the life of me.)
> apr_status_t apr_poll(apr_pollfd_t *aprset, apr_int32_t *nsds,
>                       apr_interval_time_t timeout)
> {
>     int i, rv;
>     struct pollfd *pollset;
>     struct pollfd stack_pollset[SOME_LOW_MAGIC_NUMBER_LIKE_SAY_6];

The small array on the stack is an optimization that I was discussing
with bpane last night.  It would require some testing to find the right
number, and I wasn't ready to do that.  I wanted to get the
implementation out there, and I figured we could continue to optimize it
once it was done.


View raw message