Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. How to program sleep in windows mobile

How to program sleep in windows mobile

Scheduled Pinned Locked Moved Mobile
testingbeta-testinghelptutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    anuhoho
    wrote on last edited by
    #1

    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!!!

    J 1 Reply Last reply
    0
    • A anuhoho

      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!!!

      J Offline
      J Offline
      Joel Ivory Johnson
      wrote on last edited by
      #2

      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

      J2i.net | @J2iNet

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups