2 Dec 2009 05:31
Re: get next timeout from libevent
Nick Mathewson <nickm <at> freehaven.net>
2009-12-02 04:31:56 GMT
2009-12-02 04:31:56 GMT
On Tue, Nov 24, 2009 at 03:31:18PM +0100, Filippo Giunchedi wrote: [rewrapped] > Hi, > > we are trying to build a library which uses libevent but also has > the capability to be integrated into an application's main loop. > > Our solution so far includes three functions: > - get the list of file descriptions handled by our library > (IOW the list of fds in libevent) > - register a callback to be called whenever a new fd is added > - perform a step (i.e. basically call libevent loop once) > > This way the application can poll/select on our lib fds and then make a step > whenever necessary. > > So far so good (please correct me if there's something missing :)). Hm. I'm not sure this is such a great design. If the application is *already* calling poll()/select() for you, then it's redundant to have Libevent do it as well. Worse, if the application is actually using poll or select, then you'll lose all the performance benefits that you'd get from Libevent's use of fast backends like kqueue, epoll, or evport. Also, how are you getting "the list of fds in Libevent"? FWICT, there isn't a public interface that exposes that. > At this point though the application won't be able to get the > timeout for the next event because AFAICS libevent's timeout_next()(Continue reading)
RSS Feed