Mladen Turk wrote:
Hi,

I propose a new function apr_poll_modify, or
modifying apr_poll_add to be able to change
the interest ops/events for a designated apr_pollfd_t.

The point is to have an option to modify the
request events (poll options) without the need
to remove/add the same socket with different reqevents.

For example initially the socket might be
registered with APR_POLLIN, and then later after
the pollset_poll call it might be registered as
APR_POLLOUT without the need for remove/add.

It can be done two ways:

1. By using existing apr_pollset_add and depending
   if the apr_pollfd_t is already member of the
   pollset or not, execute real add or modify.
   This would allow possibility to be backported.

2. Adding a new function apr_pollset_modify.

I would prefer the first way, because it mean
'add' or 'add with different reqevents'.
The only drawback I can see is that it would
disallow to have a apr_pollfd_t added multiple
times to the pollset (BTW I think that we wish
to disable that anyhow by looking at the select.c
where we explicitly search for duplicate fd's on
remove).

I believe we would be better off finishing the pollcb api:
http://svn.apache.org/repos/asf/apr/apr/branches/pollcb-dev/poll/unix/epoll.c

And adding a modify to that API -- since it makes better assumptions about the lifetimes of apr_pollfd_t's. I don't think the _modify paradigm will be easy to push onto the current apr_pollset API.

-Paul

Reply via email to