sleep

PHP sleep() silently hogs CPU

I'm running Apache on Linux within VMWare. One of the PHP pages I'm requesting does a sleep(), and I find that if I attempt to request a second page whilst the first page is sleep()'ing, the second page hangs, waiting for the sleep() from the first page to finish. Has anyone else seen this behaviour? I know that PHP isn't multi-threaded...

Sleep Less Than One Millisecond

On windows you have a problem you typically never encounter on Unix. That is how to get a thread to sleep for less than one millisecond. On Unix you typically have a number of choices (sleep, usleep and nanosleep) to fit your needs. On windows however there is only Sleep with millisecond granularity. You can however use the select system...

Sleeping problems, computer addiction

How do you keep your mind from racing late into the night, thinking about programming problems, keeping you awake? My sleeping disorder / computer addiction has impacted my personal life in a very negative way and I'm having a hard time doing anything about it. Taking pills won't help because part of me wants to stay awake. I keep on te...

time.sleep -- sleeps thread or process?

In Python for the *nix, does time.sleep() block the thread or the process? ...

What happens to my app when my Mac goes to sleep?

When Mac OS X goes to sleep, due to closing a laptop or selecting "Sleep" from the Apple menu, how does it suspend an executing process? I suppose non-windowed processes are simply suspended at an arbitrary point of execution. Is that also true for Cocoa apps, or does the OS wait until control returns to the run loop dispatcher, and go...

What's the algorithm behind sleep() ?

Now there's something I always wondered: how is sleep() implemented ? If it is all about using an API from the OS, then how is the API made ? Does it all boil down to using special machine-code on the CPU ? Does that CPU need a special co-processor or other gizmo without which you can't have sleep() ? The best known incarnation of sle...

Is there an equivalent to Thread.sleep when dealing with Eclipse Jobs?

I am writing Eclipse plugins where there are quite a few running jobs. In some cases, I want the job to "sleep" for a while at the current point of execution and continue from that spot (rather than reschedule the job and start it from scratch). My understanding is that using Thread.sleep within Eclipse jobs is quite deprecated. Is th...

how do I wait on console input in c# for 15 seconds or so.

I need to ask for input in console and wait for few sec may be a min after that I need to default to some value. How can basically time our on console input in c# and proceed with default settings? If you have sample code that would be great. ...

How can I know when Windows is going into/out of sleep or Hibernate mode?

Is it possible to subscribe to a Windows event that fires when Windows is going into or coming out of Sleep or Hibernate state? I need my application to be made aware when the computer is going to sleep to do some cleanup and avoid timing issues when it comes out of sleep. ...

Is there an alternative for sleep() in C?

In traditional embedded programming, we will give a delay function like so: for(i=0;i<255;i++) for(j=0;j<255;j++); In the microprocessor's view, is this how the sleep() function works? Is there an alternative for the sleep() function in C? ...

sleep() is stalling my program too early. What am I doing wrong?

I want to write a small program that should print something like testing CPU... done testing RAM... done and so on. I wrote the following program in C: printf( "testing RAM...\t\t" ); sleep( sleep_time ); printf( "done\n\n" ); printf( "testing HDD...\t\t" ); sleep( sleep_time ); printf( "done\n\n" ); where sleep_time i...

Which is the better method? Allowing the thread to sleep for a while or deleting it and recreating it later?

We have a process that needs to run every two hours. It's a process that needs to run on it's own thread so as to not interrupt normal processing. When it runs, it will download 100k records and verify them against a DB. The framework to run this has a lot of objects managing this process. These objects only need to be around when th...

SQL Server 2005 - closing sleeping connections

I seem to have an app on my Dev server that has lots of open connections (they should be there, but some bad data layer was used to open them, that forgot to close them). I just want them closed so I can keep other apps running on the server. How can I force all the connections to close? ...

How do I get my python program to sleep for 50 msec?

See title .. ! ...

Compare using Thread.Sleep and Timer for delayed execution

I have a method which should be delayed running for a specified amount of time. Should I use Thread thread = new Thread(() => { Thread.Sleep(millisecond); action(); }); thread.IsBackground = true; thread.Start(); Or Timer timer = new Timer(o => action(), null, millisecond, -1); I had read some articles about using Thread.S...

Off screen rendering when laptop shuts screen down?

I have a lengthy number-crunching process which takes advantage of quite abit of OpenGL off-screen rendering. It all works well but when I leave it to work on its own while I go make a sandwich I would usually find that it crashed while I was away. I was able to determine that the crash occurs very close to the moment The laptop I'm usin...

How to programmatically bring a laptop into Sleep mode.

What API or tools can I use to query the capabilities of the system and choose the most appropriate on for putting the PC to Sleep, Hibernate or shutdown mode? Thanks for any pointers. ...

What is the effect of changing system time on sleeping threads?

If you take a look at the clock_gettime() function, which is available in all BSDs and is actually defined as part of the POSIX standard, you see that there is support for at least three types of clocks (many systems support more than these clocks, but actually the POSIX standard only demands one to be present, all others are optional): ...

Debugging to Sleep

I'm having trouble with Debug(f11,etc.) using VS2008-SP1 and Vista-SP1. It randomly, but routinely, puts my computer in the sleep mode. I've looked on the web for similar problems and found nothing. ...

Thread.Sleep() in VBA

Is there an equivalent to Thread.Sleep in access- VBA? ...