Hi David,

The above explanation will hold only good if and only if the timers
are in ascending order or descending order.Not ina  random fashion
which i missed to mention

Timer1 start --- > 10sec --- > 1sec,2sec,..........10 sec
Timer2 start --->  15sec ----> ........1sec,
2sec ...........................15sec
Timer3 start --->  05sec----->...............1sec,2ec.....
Timer4 start --->  45sec----->.................................1sec,
2sec..........
Timer5 start --->  09sec-----
>..............................................................1sec,
2sec..........

Will the above explantion holds good in this also ? can you please
tell us.

Regards
Girish

............... Like this Timer1 and Timer2 will execute in parallel.


On Feb 2, 8:44 am, David Given <d...@cowlark.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Girish wrote:
>
> [...]
>
> > Timer1 start --- > 10sec --- > 1sec,2sec,..........10 sec
> > Timer2 start --->  15sec ----> ........1sec,
> > 2sec ...........................15sec
> > ............... Like this Timer1 and Timer2 will execute in parallel.
>
> > Can you explain more about how to acheive this using sorted list ?
>
> Lets say that timer1 is set to go off at now+10, then now+11, then
> now+13, then now+23; and timer2 is going to go off at now+15, then
> now+16, then now+18, then now+33. (Sorry, I couldn't quite read your
> chart.) Sort these together, and what you get is:
>
> now+10 (timer1)
> now+11 (timer1)
> now+13 (timer1)
> now+15 (timer2)
> now+16 (timer2)
> now+18 (timer2)
> now+23 (timer1)
> now+33 (timer2)
>
> So you can see that the first thing that's going to happen is that
> timer1 will expire at now+10. So you set the single hardware timer to
> the desired time, and your app goes off and does other things. When the
> hardware timer goes off, you look at the topmost item on the list, and
> see that it's timer1. You now do whatever timer1 is supposed to do when
> it expires, and remove it from the list. The next item is now+11, so you
> reset the hardware timer for a second later and continue.
>
> The fact that you've got multiple timers is irrelevant; we live in a
> universe with only kind of time, so there's only one order in which
> events can happen. The earliest event *must* happen before the later
> events happen, so you only need to wait for the earliest event.
>
> - --
> David Given
> d...@cowlark.com
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org
>
> iD8DBQFJhmwYf9E0noFvlzgRAkyaAKCCXEdoNxspL1SdilNECgxrcICk5gCgudlY
> TnYKftMhQctMDgbR8hbY+vA=
> =RS2e
> -----END PGP SIGNATURE-----
--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---

Reply via email to