Using ev_periodic with a custom loop and a specific start time
schmorp at schmorp.de
Wed Apr 8 09:36:12 CEST 2009
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).
> 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.
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / pcg at goof.com
More information about the libev