On Fri, May 02, 2014 at 01:19:42AM +0400, Nick Zavaritsky <mej...@gmail.com> wrote: > There is one thing that still bothers me: now it takes two epoll_wait() calls > for Nginx to fetch the events > instead of one. (One epoll_wait() in libev plus another epoll_wait() for the > nested epoll fd maintained > solely by Nginx). Though the overhead is probably negligible I would prefer > to have it another > way around, i.e. let Nginx control the 'outermost' event loop while libev > drives the embeded loop.
There is currently no interface for this in libev, as it would be quite complex to do right (the fd can change at virtually any time, if it even exists, so this would itself need to be event driven, e.g. via a new watcher or a simple callback - probably the latter, since it's unlikely that there will be many users for this feature). You would have to be prepared to handle a change to the fd at basically any time, including a change to no fd. > For example libuv has uv_backend_fd() and uv_backend_timeout(); but I can't > find anything > similar in libev. The joys of pain - while they have that, it's an unfortunate case of "they don't know what they do". There was a discussion where I explained why it wouldn't work reliably, but they hacked it into their copy of libev nevertheless, resulting in (I guess) subtly broken programs that seem to work fine at first. Most likely, the only way to use the libuv interface with some hope of correctness is to poll the fd in every loop iteration, which would be even slower than two epoll_wait calls, so the libuv interface doesn't seem to actually do what you hope it would do... So, my suggestion is to find out whether the added complexity of reacting to fd changes (and the possibility of not having an fd!) is actually worth the effort in handling it, and then we can talk about an API. -- The choice of a Deliantra, the free code+content MORPG -----==- _GNU_ http://www.deliantra.net ----==-- _ generation ---==---(_)__ __ ____ __ Marc Lehmann --==---/ / _ \/ // /\ \/ / schm...@schmorp.de -=====/_/_//_/\_,_/ /_/\_\ _______________________________________________ libev mailing list libev@lists.schmorp.de http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev