sleep

Windows C/Sleep() function during clock drift.

If I run something like Sleep(10000), and the system clock changes during that, will the thread still sleep for 10 seconds of wall-clock time, or less or more? I.e. does the Sleep() function convert milliseconds into hardware ticks? ...

Flabberghasted by shellexecuted (VBA)

hi everyone, I'm trying to extract some values out of a file and into my excel 2007 workbook, using VBA and the dreaded Sendkeys function (copy-paste) after a shellexecuteEx call. Now, my macro is working fine when the file in question has already been loaded into the system memory. But if I'm running it with the file never having been ...

Setting a timer?

I'm uploading a file, all working fine, but I want to set a time for 60 seconds, so it waits for the file to upload before moving on. Any ideas? ...

boost::this_thread::sleep() vs. nanosleep()?

I recently came across the need to sleep the current thread for an exact period of time. I know of two methods of doing so on a POSIX platform: using nanosleep() or using Boost::this_thread::sleep(). Out of curiosity more than anything else, I was wondering what the differences are between the two approaches. Is there any difference i...

PHP output text before sleep

Hello, I want PHP to output some text, then sleep for a minute and a half, and then output some more text. <?php echo 'Output one.'; usleep(1500000); echo 'Output two.'; ?> My problem is that all text is being put out simultaneously - after having waited those 1.5 seconds. I have read something about a function called flush - but...

iPhone App: How do I call a function after my iPhone has been to sleep?

I have an app with some animations which are called by timers. When one animation finishes then a timer is called to start another. If the iPhone sleeps and requires unlocking to activate it then the animations do not start. This is obviously because the timer ends whilst the app is asleep and then the function to restart an animation do...

iPhone: Force UIButton to redraw itself

Hi, I have a little problem and I would be gratefull if someone could help me. I got 5 UIButtons placed next to each other and what I wanna do is set image on first button, redraw it so it, wait for 1 second, then set some other image on second button, redraw second button and so on. I tried to set image on button, then call function sle...

Axis2, using Thread.sleep to do blocking

I am currently coding a Java WebService using axis2. However, one particular request needs me to do constant polling a status in another server for around 3-10 seconds time. I want to use Thread.sleep to do polling like every 500 mili for 3 seconds. Does it have any implication like performance issue or can anyone suggest a better idea...

sleep for many days with resolution of microseconds

Is there a way to put a thread to sleep for many days with a resolution of microseconds? usleep can only put the thread to sleep for 1000000 and sleep works in second steps. Is there a way to, may be, use both sleep and usleep to achieve this? ...

Putting iPhone into Sleep Mode Programatically

Hi all, I had used the following code to prevent the iPhone from entering the sleep mode. [UIApplication sharedApplication].idleTimerDisabled=YES But is it possible to put the iphone in Sleep mode programatically ? Thanks ...

Robot.delay(int) versus Thread.sleep(long)

I have a program whose only purpose is to drive a java.awt.Robot in an infinite loop until an exit condition is met. The robot performs a number of actions in quick succession, which require a standard UI delay between them. For this, I use java.awt.Robot.setAutoDelay(int ms), which appears to be designed for precisely this purpose. At...

How to pause execution yet keep webbrowser control loading in C#.

I'm trying to make a web browser that tells me when a specific video is done. I already know how to get the time in seconds of how long it takes. I just need to know how to wait to execute the next step without stopping the webbrowser control (which needs to play the flash video). Any ideas? I've been looking into the Timer class, but c...

Android Froyo and Wifi

Hi, By default, Wifi sleep policy is "Sleep on screen idle". With this policy, is it possible for a Background Service at a later time to wake up Wifi using some API? Am trying the following, but does not work: When my Background Service wakes up, it calls "ConnectivityManager.getActiveNetworkInfo()" to get active network. Since, the ...

Perl script is getting killed during sleep()

I have a quite simple perl script, that in one function does the following: if ( legato_is_up() ) { write_log("INFO: Legato is up and running. Continue the installation."); $wait_minutes = $WAITPERIOD + 1; $legato_up = 1; } else { my $towait = $WAITPERIOD - $wait_minutes; write_...

Have a LaunchAgent sleep when the computer sleeps.

I'm creating a daemon that will be installed in the LaunchAgents folder. Some questions about making it sleep: Because it's a LaunchAgent item will the executable automatically sleep when the user/system sleeps? If the answer is yes to question 1, do I need to specify anything in the plist document? If the answer is no to question 1, w...

C# killing a thread

Hi guys, In my app, I have a thread that runs continuously. By using Thread.Sleep(), the function executes every 10 minutes. I need to be able to kill this thread when a user clicks a button. I know Thread.Abort() is not reliable. I can use a variable to stop the thread, but since it is sleeping it could be another 10 minutes before th...

Laptop/Desktop Sleep Events

I was wondering if there was an event that is triggered when a laptop or desktop goes into sleep mode. An example would be: When a user is working on his/her laptop and he/she flips the monitor down, the laptop goes into sleep mode. Or when a user goes to Start → Shutdown → Sleep. Are there any events built into .NET that determine t...

can the execution of statements in Python be delayed?

I want it to run the first line print 1 then wait 1 second to run the second command print 2, etc. Pseudo-code: print 1 wait(1 seconds) print 2 wait(0.45 seconds) print 3 wait(3 seconds) print 4 ...

sleep function in Windows, using C

I need to sleep my program in Windows. What header file has the sleep function? ...

Is it possible to know when the iPhone will go to sleep?

Is there any notification I can listen to that will alert me that the phone will go to sleep? I have implemented the following: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resignActive:) name:UIApplicationDidEnterBackgroundNotification ...