Hi all,

Currently libevent only supports setting timers relative to the time at which they are set. Used directly, this is unsuitable for streaming media, which require packets sent at a well controlled overall rate. I have been using code that reads the clock in the timer event service routine, and makes any necessary adjustments to the next timeout request. This works fine. However, it seems like this functionality ought to be in libevent itself, as streaming is a common requirement.

I have added a new function to my local copy of libevent - event_add_incremental() - which sets a timeout relative to the previous deadline, rather than relative to the current (typically slightly later) time. I use event_add() for the first timeout, to set an initial baseline time for the increments. What is incomplete right now is provision for overload situations, where the machine can't keep up with the event servicing, and things fall further and further behind. Falling slightly behind, and then catching up, is quite normal. That means simply rejecting requests for a deadline which is in the past is not satisfactory. Currently I am applying some latitude, and rejecting requests for deadlines which are seriously in the past. I works for my needs, but it doesn't seem a very "complete" solution.

I suspect others have faced similar issues, so I thought I would ask what they have done. I have something workable right now, for my own use. What I am trying to arrive at is a clean and flexible scheme, to offers as patches to libevent.

Regards,
Steve

_______________________________________________
Libevent-users mailing list
[email protected]
http://monkey.org/mailman/listinfo/libevent-users

Reply via email to