[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] external event loop mode without using select?
From: |
Christian Grothoff |
Subject: |
Re: [libmicrohttpd] external event loop mode without using select? |
Date: |
Wed, 9 Feb 2022 08:39:46 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 |
If your platform supports it, you should grab the epoll FD from
libmicrohttpd and only plug that single FD into your event loop,
effectively cascading the two event loops.
See MHD_DAEMON_INFO_EPOLL_FD for how to grab that FD.
On 2/8/22 11:49 PM, Greg Stark wrote:
> I have an existing event loop and other events I need to handle so I
> was planning to use external select mode. However I'm surprised that
> MHD_get_fdset is the only way to get the set of file descriptors.
>
> It seems pointless to have MHD loop over its file descriptors
> constructing an fdset and then I have to loop over the fdset to pick
> out the file descriptors to add them to the event loop handler (which
> preferentially uses epoll, kqueue, or poll).
>
> I'm not expecting a large pool of web connections, in fact I would
> rarely have more than one concurrent connection however there are a
> lot of file descriptors used elsewhere in the application so the
> maximum fd number might actually be large. fd_sets are a particularly
> impractical api for this.
>