sleep

resize groupbox with sleep between iteration show up after loop ends

I make new project and simplified it to check if this bug is real, and this is my code: private void button1_Click(object sender, EventArgs e) { for (int i = 0; i < 10; i++) { groupBox1.Height += 1; Thread.Sleep(100); } } private void button2_Click(object sender, EventArgs ...

How to wait periods of 30 second to run a service

I, i have a service and i want that once it started, it performs is work every 30 seconds. How can i do that? Tnk Valerio ...

oracle sleep or lock to check the processing

I just want to see whether the data is getting inserted on the table or not.. So i have written like this: select count(*) from emp; dbms_lock.sleep(1); select count(*) from emp; So that it will sleep for 1 min . Even after sleep if the 1st count and 2nd count are different then the data is getting inserted into the table. Otherwise...

Perl ithreads: Do some math instead of sleeping

I am using perl ithreads and things work fine, unless I decide to have threads sleep. Lets say my routine thread_job is passed as an entry for several threads to start running concurrently. thread_job() { ... sleep 2; #do other stuff here } If I dont have a sleep I have no issues with the threads running and they do their tasks f...

Significance of Sleep(0)

I used to see Sleep(0) in some part of my code where some infinite/long while loops are available. I was informed that it would make the time-slice available for other waiting processes. Is this true? Is there any significance for Sleep(0)? Thanks. ...

Sleep performance

Hello, I am developing a program in c++ and I have to implement a cron. This cron should be executed every hour and every 24 hours for different reasons. My first idea was to make an independent pthread and sleep it during 1h every time. Is this correct? I mean, is really efficient to have a thread asleep more than awake? What are the in...

Process sleep when form loses focus

While writing a server application with a windows form for a GUI a problem appeared. When a form loses focus the process sleep, so any networking will not work unless the form is in focus the whole time. Is there any way of creating a dialog or window that will keep its process running continuously? I call a function called cServer::Ge...

How do I create a pause/wait function using QT

Hello, I'm playing around with QT and I want to create a simple pause between two commands. However it won't seem to let me use Sleep(int mili); and I can't find any obvious wait functions. I am basically just making a console app to test some class code which will later be included in a proper QT GUI, so for now I'm not bothered about...

How to make a thread sleep for specific amount of time in java?

I have a scenario where i want a thread to sleep for specific amount of time. Code: public void run(){ try{ //do something Thread.sleep(3000); //do something after waking up }catch(InterruptedException e){ // interrupted exception hit before the sleep time is ...

Python kill thread

I'm trying to kill a thread in python. An exception would be the preferred way to do it, as a graceful exit of the run method of the thread through a try:except: pair would allow to close resources. I tried : http://stackoverflow.com/questions/323972/is-there-any-way-to-kill-a-thread-in-python , but is specifies that is doesn't work whi...

Javascript, setTimeout in while() loop / race condition

Hi all, I am thinked to try to synchronizing two scripts (own firefox extension and greasemonkey's unsafeWindow.VARIABLE); In extension: window.ISS_NEED_SEND = 0; window.SENDWHAT = 0; while ... { if (window.ISS_NEED_SEND === 1) { writeFile(window.SENDWHAT); // safe synchronous call. window.ISS_NEED_SEND = 0; } In Greasemonkey:...

What's the best way to implement a sleep function JavaScript?

I'm aware of both setInterval and setTimeout functions but it's not suitable for my case, because I need to create an img DOM element in the interval of 7 seconds. The count of images are not predefined (varies daily). When I use setInterval, I cannot completely stop it after certain limit (daily count). [clearInterval clears iterati...

Thread.Sleep(Timeout.Infinite) performance issues

Main execution path (main thread) is going to be forked into two execution paths (two new threads on different jobs) but the main thread is no longer needed. I can assign one of the tasks to main thread and save one thread (one task by main thread and another by a new thread) but I was wondering putting main thread in an infinite sleep T...

Background Running Python Script keeps stopping

I made a .pyw python script that I want to have running in the background of my computer. Right now I have it set to launch by putting it in the Startup folder of my Windows 7 computer, which should trigger it to launch whenever it starts up. The problem is that the script seems to stop running at some point for some reason. I think it...

Mac Terminal: How to get faster screencaptures?

I've written the following script to help me get successive screencaptures. I'm able to get the screencaptures to happen in successive files, but not as fast as I'd like them. The sleep rate isn't recognized after a certain point. What are the decimal limits for 'sleep'? If it can in fact go lower, is there something wrong with my scri...

implement time delay in c

Hi! I don't know exactly how to word a search for this.. so I haven't had any luck finding anything.. :S I need to implement a time delay in C. for example I want to do some stuff, then wait say 1 minute, then continue on doing stuff. Did that make sense? Can anyone help me out? ...

What is a practical use for PHP's sleep() ?

I just had a look at the docs on sleep(). Where would you use this function? Is it there to give the CPU a break in an expensive function? Any common pitfalls? Cheers. ...

Java: alternative to sleep in loop?

I need to listen to a serial input continuously, but NetBeans warns "Invoking Thread.sleep in loop can cause performance problems." I understand why this causes performance problems, but what is the best alternative in Java? public class SerialIO extends javax.swing.JFrame { ... class RcvTask extends Thread { public void...

Ruby Sleep in a Loop in Thread

Hello, I have the exact same problem posted here a year ago: http://stackoverflow.com/questions/1347853/ruby-loop-failing-in-thread Here the code (pretty much the same as in the topic above) class NewObject def my_funk t = Thread.new { until false do puts sleep 15 # sleeps way too much ...

Would a scheduled Java app run when Windows is in sleep mode ?

If I start a Java app, it initiates and does some work then goes to thread sleep for an hour, then wake up after an hour and does some more work ... But my PC is running Win7 and after 15 minutes of inactivity, it will go into sleep mode, so my question is : an hour from I started the Java app, if I don't touch the PC, and it goes into ...