apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Querna <c...@force-elite.com>
Subject Re: apr_pollset, modifying reqevents
Date Tue, 27 Jun 2006 18:12:40 GMT
Mladen Turk wrote:
> Paul Querna wrote:
>> 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.
>>
>> 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.
>>
> 
> I think its not that complicated:
> 
> found = 0
> for (...)
>    if descriptor part of pollset
>       found = 1
> 
> if  found
>   ret = epoll_ctl(pollset->epoll_fd, EPOLL_CTL_MOD,
>                   descriptor->desc.f->filedes, &ev);
> else
>   ret = epoll_ctl(pollset->epoll_fd, EPOLL_CTL_ADD,
>                   descriptor->desc.f->filedes, &ev);

Yeah, but this is an O(n) operation. Suck.

With apr_pollcb, it could be an O(1) operation.  Maybe its okay to add
it to apr_pollset, as long as we document how inefficient it is :)

-Paul

Mime
View raw message