Questions tagged [wait]

In programming, 'wait' refers to the act of pausing the execution of a program until a specific condition is met or a given amount of time has passed.

In programming, 'wait' refers to the act of pausing the execution of a programm until a specific condition is met or a given amount of time has passed.

3454 questions
1342
votes
33 answers

Difference between "wait()" vs "sleep()" in Java

What is the difference between a wait() and sleep() in Threads? Is my understanding that a wait()-ing Thread is still in running mode and uses CPU cycles but a sleep()-ing does not consume any CPU cycles correct? Why do we have both wait() and…
Geek
  • 23,089
  • 20
  • 71
  • 85
781
votes
13 answers

How do I wait for a pressed key?

How do I make my python script wait until the user presses any key?
Janusz
  • 187,060
  • 113
  • 301
  • 369
741
votes
35 answers

How to wait in bash for several subprocesses to finish, and return exit code !=0 when any subprocess ends with code !=0?

How to wait in a bash script for several subprocesses spawned from that script to finish, and then return exit code !=0 when any of the subprocesses ends with code !=0? Simple script: #!/bin/bash for i in `seq 0 9`; do doCalculations $i…
tkokoszka
  • 11,647
  • 10
  • 30
  • 25
567
votes
8 answers

How do I make a delay in Java?

I am trying to do something in Java and I need something to wait / delay for an amount of seconds in a while loop. while (true) { if (i == 3) { i = 0; } ceva[i].setSelected(true); // I need to wait here …
ardb
  • 6,075
  • 5
  • 14
  • 16
381
votes
1 answer

JavaScript sleep/wait before continuing

I have a JavaScript code that I need to add a sleep/wait function to. The code I am running is already in a function, eg: function myFunction(time) { alert('time starts now'); //code to make the program wait before continuing alert('time…
user2370460
  • 7,470
  • 10
  • 31
  • 46
376
votes
3 answers

Difference between wait and sleep

What is difference between wait and sleep?
tirenweb
  • 30,963
  • 73
  • 183
  • 303
311
votes
10 answers

Why must wait() always be in synchronized block

We all know that in order to invoke Object.wait(), this call must be placed in synchronized block, otherwise an IllegalMonitorStateException is thrown. But what's the reason for making this restriction? I know that wait() releases the monitor, but…
diy
  • 3,590
  • 3
  • 19
  • 16
273
votes
11 answers

How to tell PowerShell to wait for each command to end before starting the next?

I have a PowerShell 1.0 script to just open a bunch of applications. The first is a virtual machine and the others are development applications. I want the virtual machine to finish booting before the rest of the applications are opened. In bash I…
John Mee
  • 50,179
  • 34
  • 152
  • 186
212
votes
15 answers

Wait for a process to finish

Is there any builtin feature in Bash to wait for a process to finish? The wait command only allows one to wait for child processes to finish. I would like to know if there is any way to wait for any process to finish before proceeding in any…
Biswajyoti Das
  • 7,881
  • 11
  • 34
  • 26
207
votes
7 answers

A simple scenario using wait() and notify() in java

Can I get a complete simple scenario i.e. tutorial that suggest how this should be used, specifically with a Queue?
Olaseni
  • 7,698
  • 16
  • 44
  • 68
177
votes
7 answers

How to wait for a keypress in R?

I want to pause my R script until the user presses a key. How do I do this?
Contango
  • 76,540
  • 58
  • 260
  • 305
176
votes
12 answers

Wait one second in running program

dataGridView1.Rows[x1].Cells[y1].Style.BackColor = System.Drawing.Color.Red; System.Threading.Thread.Sleep(1000); İ want to wait one second before printing my grid cells with this code, but it isn't working. What can i do?
Selçuklu Ebrar
  • 2,059
  • 3
  • 14
  • 11
175
votes
10 answers

jQuery: Wait/Delay 1 second without executing code

I can't get the .delay method working in jQuery: $.delay(3000); // not working $(queue).delay(3000); // not working I'm using a while loop to wait until an uncontrolled changing value is greater than or equal to another and I can't find any way to…
Nahydrin
  • 13,197
  • 12
  • 59
  • 101
171
votes
12 answers

IllegalMonitorStateException on wait() call

I am using multi-threading in java for my program. I have run thread successfully but when I am using Thread.wait(), it is throwing java.lang.IllegalMonitorStateException. How can I make a thread wait until it will be notified?
Prakash Panjwani
  • 2,540
  • 5
  • 23
  • 34
149
votes
27 answers

Selenium wait until document is ready

Can anyone let me how can I make selenium wait until the time the page loads completely? I want something generic, I know I can configure WebDriverWait and call something like 'find' to make it wait but I don't go that far. I just need to test that…
Girish
  • 1,981
  • 3
  • 17
  • 18
1
2 3
99 100