How to program sleep in windows mobile
-
Hi I have an application in which i have a thread which is expected to do an activity after half hour. SO i used sleep() but while testing(in one scenario) i saw that when the device go in the sleep mode then the time taking to do the activity for that thread is more then the desired time of 30 mins. That is my sleep() is not working accurately when my device goes in the sleep mode. So how can i programatically make a 30 min delay without using any info from the device OS(like gettickcount etc). My application works fine if I keep the device awake i.e., if i dont allow it to go to the sleep mode forcefully. But the problem arises when it goes to the sleep mode. The time taking is much more ... Is there any remedy for that. Thanks in advance!!!
-
Hi I have an application in which i have a thread which is expected to do an activity after half hour. SO i used sleep() but while testing(in one scenario) i saw that when the device go in the sleep mode then the time taking to do the activity for that thread is more then the desired time of 30 mins. That is my sleep() is not working accurately when my device goes in the sleep mode. So how can i programatically make a 30 min delay without using any info from the device OS(like gettickcount etc). My application works fine if I keep the device awake i.e., if i dont allow it to go to the sleep mode forcefully. But the problem arises when it goes to the sleep mode. The time taking is much more ... Is there any remedy for that. Thanks in advance!!!
I just answered this above, but for the sake of some one else that reads this question you shouldn't use Sleep to schedule a thread to run. Instead you must use CeRunAppAtTime. For information on using this function with an event you can see the MSDN documentation page ( here[^]) or you could see the CodeProject.com article I wrote on scheduling a program to automatically start (which is also applicable to threads ig you use the info at the above link) from here[^].
Joel Ivory Johnson