Erratic timers

Graham Leggett minfrin at sharp.fm
Sat Nov 29 01:45:24 CET 2008


Hi all,

I am struggling getting a simple timer to work with libev. What I want 
to achieve is a timer that gets called immediately, and then repeating 
every 2 seconds after that.

The docs describe various complex timer options, but miss the simplest 
version, and I am struggling for some reason.

If I do the following:

   ev_timer_init(&msg->timer.timer, watch_timed_message_cb, 0., 2.);
   ev_timer_start(msg->c->s->e->loop, &msg->timer.timer);

I expect the timer to fire in 0. seconds, and then start repeating every 
2. seconds after that.

Instead the timer fires off once immediately, and then nothing.

Can anyone confirm whether there are further steps that I need to take 
before this will work?

Regards,
Graham
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3287 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20081129/f77db685/attachment.bin>


More information about the libev mailing list