apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Pane <bri...@apache.org>
Subject Re: [Request for comments] new poll API
Date Mon, 29 Jul 2002 16:54:25 GMT
Jeff Trawick wrote:

>Brian Pane <brianp@apache.org> writes:
>
>  
>
>>To continue the recent discussions on the problems in the current
>>apr_poll API, here's a patch for apr_poll.h that illustrates my
>>proposed fix.
>>
>>What I'm proposing here is to split the API into two parts:
>>
>>  - A lightweight, single-function poll API for use (only!)
>>    with very small sets of descriptors.
>>    
>>
>
>Do we really need this API?  What is the sort of APR application for
>which the heavy-duty API is harmful?
>

This API really just adds programming convenience.  There's nothing
it provides that can't be done with the general-purpose API.  But the
main limitation of the general-purpose API is that, because it involves
some memory allocation, you can't use it for spontaneous, one-time poll
calls (like checking for readability on a single input socket if read
just returned EAGAIN) unless you can guarantee that the number of such
calls during the lifetime of the request pool has an upper limit.  With
the general-purpose poll API, the solution is to hold onto your poll
object and re-use it if you have to poll the same descriptor(s) again.
The lightweight API just provides a simpler alternative for cases where
keeping track of the pollset object(s) would be prohibitively complex.

--Brian



Mime
View raw message