Hi David,
I have developed it using threads.

For every timer there is a corresponding thread. and time for what
timer is set i made thread to sleep.
thread is kept sleeping for timed out "time".
After that i call callback function.

is this right method????

Thanks
kuldeep


On Feb 2, 10:03 am, Girish <htgir...@gmail.com> wrote:
> 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 hardwaretimerto
> > the desired time, and your app goes off and does other things. When the
> > hardwaretimergoes 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 hardwaretimerfor 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