On Mon, Mar 14, 2016 at 8:51 PM, Graham Leggett <minf...@sharp.fm> wrote:
> On 14 Mar 2016, at 10:32 AM, Yann Ylavic <ylavic....@gmail.com> wrote:
>
>> Since apr_pollfd_t is not opaque (unlike apr_socket_t), maybe we could
>> remove the indirection here (and in the code below) with somthing like
>> (apr_pollfd_t *pfds, size_t npfds, ...).
>> That would allow a single allocation (all pfds in once) and possibly
>> make things easier for the caller.
>
> Having looked at this in more detail this isn’t as simple.
>
> The sticking point is the cleanup, which needs to be passed a single struct 
> to do it’s work. To pass both the pfds and the npdfs these two need to be 
> wrapped in a structure of some kind, which the user has to feed in from the 
> outside common to both register and unregister. This structure probably 
> should be an apr_array_header_t.

Hmm right, either this or, say, the ending pfd is the one with
->reqevents=0, or ->p=NULL, or probably better
->desc_type=APR_NO_DESC.
Up to the caller to ensure this, it could possibly be documented.

>
> Is it worth making the change from apr_pollfd_t **pfds to apr_array_header_t 
> *pfds?

That would still require some "complex" initialization, so I'd prefer
the above if it doesn't sound to hacky...

Regards,
Yann.

Reply via email to