sleep

How to keep a .NET console app running?

Consider a Console application that starts up some services in a separate thread. All it needs to do is wait for the user to press Ctrl+C to shut it down. Which of the following is the better way to do this? static ManualResetEvent _quitEvent = new ManualResetEvent(false); static void Main() { Console.CancelKeyPress += (sender,...

How effective is Thread.sleep(long)?

Let's say I want to "pause" a thread so that other threads can run more efficiently. What is the minimum sleeping period before blocking becomes pointless (or almost pointless)? ...

SSRS 2008 Resuming from Sleep

Does anyone know a way to prevent SSRS 2008 from sleeping, after not being used for a while (not sure of the time-out) it takes quite a while to wake up, which is causing a timeout issue? ...

Multithreading, when to yield versus sleep

hello. To clarify terminology, yield is when thread gives up its time slice. My platform of interest is POSIX threads, but I think question is general. Suppose I have consumer/producer pattern. If I want to throttle either consumer or producer, which is better to use, sleep or yield? I am mostly interested in efficiency of using eith...

sleep/wait in android apps

Hi, I had an activity which calls a thread for 10times one after another. However, if the network is slow or too much information loaded, force close will occur. Will adding sleep in each thread help to solve this problem? or is there any other ways to solve it? public void run() { if(thread_op.equalsIgnoreCase("xml")){ ...

OS Reboot, Shutdown, Hibernate, Sleep, Wakeup (Windows Python)

Hi, I'm looking for an automatize way of doing Windows Power Management functions: - Reboot - Shutdown - Hibernate - Sleep - Wakeup Is there a Python module to cover this functionality? Of course any other solutions are also appreciated... ...

Is there a way to figure out which web page is associated with which query?

I'm running a LAMP stack. When I go into phpmyadmin, I can see that there are quite a number of sleeping connections which probably should be closed. Is there a way, using either Apache or MySQL, to determine on which pages those connections are created? ...

VBA Sleep Doesn't Work...

I know I'm doing something wrong here. I'm trying to use the sleep function to delay my code, but I get "Sub or Function not defined" error. Any tips? ...

what should happen if the kernel attempts to awaken all processes are sleeping on an event but no processes are asleep on that event at the time of wake up?

what should happen if the kernel attempts to awaken all processes are sleeping on an event but no processes are asleep on that event at the time of wake up? ...

Java - Thread problem

My question is related to all those methods(including Thread.sleep(...)) which throw InterruptedException. I found a statement on Sun's tutorial saying InterruptedException is an exception that sleep throws when another thread interrupts the current thread while sleep is active. Is that means that the interrupt will be ignored if ...

Using Sleep with findstr in a .bat

I created a .bat file with the below lines cd C:\MyFolder d: findstr "Apple" C:\log.txt |findstr "red" > red_apples.txt SLEEP 3600 GOTO START When the bat is executed, the SLEEP is not working and the commands are running continously. Is there anything wrong with the code? Please help ! ...

Sleeping a thread is blocking stdin

Hey, I'm running a function which evaluates commands passed in using stdin and another function which runs a bunch of jobs. I need to make the latter function sleep at regular intervals but that seems to be blocking the stdin. Any advice on how to resolve this would be appreciated. The source code for the functions is def runJobs(comp...

DLL Needed For Excel VBA Sleep()?

When using: Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Is it required to have some sort of DLL? If so, which DLL and where can I obtain it? ...

Looking for a simple alternative to Thread.Sleep

HI, During the development of my app, I was using Thread.Sleep to give our external devices some time to adjust to settings before making queries, as they are quite old and slow. I now want to replace these with something a bit more stylish and correct. Does anyone have a simple way to "wait" for a device rather than sleep, bearing in...

Write to file using CopyHere without using WScript.Sleep

Hi guys, I've written a small VBScript to creates a .zip file and then copies the contents of a specified folder into that .zip file. I copy the files over one by one for a reason (I know I can do the whole lot at once). However my problem is when I try to copy them one by one without a WScript.Sleep between each loop iteration I get a...

Need help getting Suspend to work in Ubuntu on laptop

I've been doing a lot of research, but I've got to admit right out front that I'm not even sure exactly what is the right question. I've installed Kubuntu 10.4 on a Panasonic Toughbook CF-29. When I try to uses "suspend", the screen flickers, and then the hard drive light goes off but the power light stays on. I looked at the /var/log...

Bash: infinite sleep

I use startx to start X which will evaluate my .xinitrc. In my .xinitrc I start my window manager using /usr/bin/mywm. Now, if I kill my WM (in order to f.e. test some other WM), X will terminate too because the .xinitrc script reached EOF. So I added this at the end of my .xinitrc: while true; do sleep 10000; done This way X won't te...

c++, sleep, and loops

Ok, this is just out of curiousity, but why does the sleep function NOT work in a loop, or how can I Get it to work in a loop? for(int i = 0; i < 5; i++) { cout << i << endl; sleep(2); } ...

What is the difference between Thread.Sleep(timeout) and ManualResetEvent.Wait(timeout)?

Both Thread.Sleep(timeout) and resetEvent.Wait(timeout) cause execution to pause for at least timeout milliseconds, so is there a difference between them? I know that Thread.Sleep causes the thread to give up the remainder of its time slice, thus possibly resulting in a sleep that lasts far longer than asked for. Does the Wait(timeout) m...

How to use Sleep in the application in iphone

Hi, I have used to loading a default image in my appication. So i have set to, Sleep(3); in my delegate.m class. But sometimes it will take more than 6 to 7 minutes. So i want to display the image 3 seconds only and then it goes to my appilcation based on my requirements. Which one is best way to do that? Sleep(3) or [...