Using ev_periodic with a custom loop and a specific start time

Luca Barbato lu_zero at gentoo.org
Wed Apr 8 15:56:27 CEST 2009


Marc Lehmann wrote:
> On Wed, Apr 08, 2009 at 02:03:51AM +0200, Luca Barbato <lu_zero at gentoo.org> wrote:
>>> if you are wondering about the order of execution fo the callbacks, then note
>>> that this is undefined. if you need a timer to execute before another timer
>>> when both become pending at the same time, you need to use priorities.
>> is there a recipe for that already?
> 
> Not really, but using priorities is generally straightforward.
> 
> Something that occured to me is that ev_periodic sounds like the right thing
> when you want to play somehting at a specific (wallclock) time, but your
> problem sounds more like requiring specific inter-packet delays, in which
> case an ev_timer would be the right thing (it isn't affected by time jumps).

The problem is that we need both. The rtsp play receives (among the 
other things) a time reference about when to start playing, then you are 
supposed to send packets at variable delays, I just used an ev_periodic 
to do both...

> 
>> I wrote a bare loop that is more or less what I'd like to archive and I  
>> got the behavior I'd expect so I guess there is something wrong  
>> somewhere else in the code, sorry for the noise =)
> 
> While I still don't know whether that's the problem or not, it is vaguely
> planned to make timer/perodioc invocation order cosnistent with their
> timeout value in some future version.

Sounds nice =)

lu


-- 

Luca Barbato
Gentoo Council Member
Gentoo/linux Gentoo/PPC
http://dev.gentoo.org/~lu_zero




More information about the libev mailing list