Hi!

I realy love the flexibility and the great design of libev, however I am a bit 
puzzled with the
event loop embeding.

The problem is that I want to mix and match code that uses libev event loop 
with the code
tailored for a very different event loop environment, all in the same thread.

This other event loop environment is actually Nginx web server. The reason I am 
willing to jump
through hoops is because of the piece of code that is to be used both in a 
standalone utility and
in a Nginx module.

Nginx event loop provides utilities to watch file descriptors for status 
changes. Timers are also
included. It's safe to assume that epoll is used for fd watching on the target 
platform.

I think it is relatively easy to embed nginx event loop inside ev_loop with but 
the pair of watchers:
ev_io for the epoll fd plus ev_timer (or maybe ev_prepare and ev_check should 
be added to the mix
as well?)

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.

Is this possible with libev?

For example libuv has uv_backend_fd() and uv_backend_timeout(); but I can't 
find anything
similar in libev.
_______________________________________________
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to