On 10/02/2016 04:02 PM, Elad Nachmias wrote:
> What is the problem with repeating timers? I think the concept of having
> a callback that is being called every fixed time interval makes lots of
> sense. I use them for multiple purposes. For instance:
> 1. I have a data structure in memory that has to be backed-up in
> physical memory. I'm using a repeating timer to save the changes in a
> while (it is not possible to make an IO request for every individual change)
> 2. I'm writing a mobile game backend server that use libwebsockets with
> a libuv events loop. it uses many repeating timers for each player (to
> send frequently updates about the game state).
> 

You will be able to rearm the timer yourself, it's trivial to do without
libuv's help.

The problems comes with how time is counted. Let's say you setup a
repeating timer at 100 ms, and the callback takes 10 ms to run. When
should the callback run, in 90ms or in 100ms?

Some people think one way, some the other way.  So the best thing to do
is nothing, just let the user decide!

At any rate, we'll be keeping uv_timer_t with its current semantics, but
the new uv_timeout request won't have a repeat argument, that's all.

-- 
Saúl Ibarra Corretgé
bettercallsaghul.com


-- 
You received this message because you are subscribed to the Google Groups 
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to