[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] get next timeout from libevent



Hi Nick,

On Tue, Dec 01, 2009 at 11:31:56PM -0500, Nick Mathewson wrote:
> > 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.

Indeed.

> 
> Also, how are you getting "the list of fds in Libevent"?  FWICT, there
> isn't a public interface that exposes that.

Correct, there isn't, but that could be kept track of in the library itself.

> 
> >  At this point though the application won't be able to get the
> > timeout for the next event because AFAICS libevent's timeout_next()
> > isn't supposed to be called from the outside, is this correct?
> 
> Right.
> 
> I wouldn't object to adding one, if there turn out to be good uses for
> it, or as part of a general extension scheme.

This might be moot now, following your suggestions below.

> 
> >  Also, what would be the correct approach to build a library upon
> > libevent which can be then integrated into another main loop?
> 
> This are just my initial thoughts, so I don't promise they're very
> good ones:

thank you very much!
the first approach looks the most sensible for now.
Whenever the library is used in a standalone application then libevent main
loop can be used without (much?) penalty by registering callbacks in the
library which themselves register events to libevent.

the other approaches are food for thought as well!

cheers,
filippo
-- 
Filippo Giunchedi - http://esaurito.net - 0x6B79D401

I find television very educating. Every time somebody turns on the
set, I go into the other room and read a book.
-- Groucho Marx
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.