apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Pane <bri...@apache.org>
Subject Re: [PATCH] pollacc.c poll.c
Date Tue, 06 Aug 2002 00:41:40 GMT
Rob Saccoccio wrote:

>The following patch to HEAD corrects problems with the transparent poll API.
>Currently, the apr_poll_t struct is handled ambiguously WRT whether its
>entries are packed or sparse.  The brokeness has probably not been apparent
>because in httpd entries are never removed.
>

I like the concept, but...

>+        else if (aprset[i].desc_type == APR_NO_DESC) {
>+            pollset[i].fd = -1;
>+            continue;
>

I'm not sure if it's safe to have an fd of -1 in the pollset.

Alternatively, we could compact the aprset array in
apr_poll_socket_remove().  This can be done in O(1)
time by swapping the removed element with the last
element in the array.  Then apr_poll() can just stop
copying descriptors as soon at it hits one with type
APR_NO_DESC.

The disadvantage of doing this, of course, is that
apr_poll_socket_remove() will thus change the ordering
of the descriptor array.  If anybody has a strong
objection to that, please let me know; otherwise,
I'll change apr_poll_socket_remove() tomorrow.

Thanks,
Brian



Mime
View raw message