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.