Questions tagged [thread-sleep]

The .net Thread.Sleep(...) method suspends the caller for a specified amount of time.

A call to Thread.Sleep(n) has no side effects, and it will not return until at least n milliseconds have elapsed.

References

815 questions
-2
votes
2 answers

Better ways to block execution in polling wait loop?

I am writing a library that communicates with several WCF endpoints. In many cases, I have to wait for a particular state or condition on the remote service. I have written a simple polling wait loop which looks something like this: private bool…
BJ Myers
  • 6,617
  • 6
  • 34
  • 50
-2
votes
2 answers

Java GUI application

I am working on a Java graphical interface (Swing , AWT) . The data entry in my application is supposed to be done via a JFrame. In fact I have 10 entities that necessitate 10 JFrames. I used a for loop but JFrames don't seem to wait until data…
-2
votes
2 answers

Similarity between sleep and join in java

As the question suggests , I want to know the similarity between the sleep and join methods on the thread. I have gone through many questions that describe the difference between the sleep and join method. But I would like to know different…
user3686864
  • 337
  • 2
  • 5
  • 13
-2
votes
1 answer

How to Multithread when already extending a class

I have a Java class which already extends the Java default UnicastRemoteObject: public class ApplicationServerImpl extends UnicastRemoteObject implements ApplicationServer I wish to create a thread within this class to perform a check periodically…
TotalNewbie
  • 1,004
  • 5
  • 13
  • 25
-2
votes
3 answers

What is the point of this sleeping thread

I am going through some code right now that is not mine. In the code there is a thread with the following code: while (true) { Thread.sleep(int.MaxValue); } It also catches InterruptedException and goes right back into the loop, so the loop…
mirhagk
  • 1,255
  • 3
  • 14
  • 28
-3
votes
2 answers

java: I am supposed to call a method 50x per second in the run method of a thread, ONLY WITH THE METHOD SLEEP (All other threads here with timer)

I have to call a method in the run method of a thread 50 times in one second, the problem is, i am only allowed to use sleep as a method! Now the problem is how can i do that, other threads here for instance: java- Calling a function at every…
mdioeh
  • 1
  • 1
-3
votes
2 answers

Pausing my app?

I have some Buttons in my application and I need to change the text in them with 1 sec delay after every change. I've tried using Thread.sleep() in the cycle but it works incorrect (all the buttons change the text at the same time). How can I solve…
-3
votes
1 answer

Change text label asp net

How change text label in asp net visual basic while running procedures or functions. For example when project is validating something, the label say the same. (Excuse me, I do not speak english)
-3
votes
1 answer

JavaFX - How to wait without freezing the UI?

I know there are some questions about this topic but none of these helped me to find a solution. I've got two Timeline Animations, I want to execute them after a delay of a few seconds. I'm gonna show you an example: Every time I click my mouse, the…
Rouman
  • 127
  • 2
  • 14
-3
votes
2 answers

How do I get my program to restart properly? (Brick Breaker)

When gameover is true and I call the startGame method from the DOWN button KeyListener, it breaks my game and doesn't allow me to click the exit button on the JFrame and the paddle doesn't work anymore. Please help. import javax.swing.*; import…
-3
votes
1 answer

C# .net screencapture from hidden site.

A graph is being generated in a webpage. I am trying to do a screen capture with C# code. I tried the code below. It worked a few times and now I get "index was out of range. must be non-negative and less than the size of the collection" error. Any…
-3
votes
1 answer

i am trying to make a pong game in android but i am stuck ,i dont know why ball isnt moving

here is the class which extends surface view , in its run method i've called the method to animate ball but the ball isnt animating public class OurView extends SurfaceView implements Runnable { Canvas c; Thread t = null; …
Red
  • 139
  • 1
  • 2
  • 9
-3
votes
2 answers

Is it possible to implement a sleep() in javascript?

This is a duplicate question. It has been asked many times before, with dozens of answers, some of them rated very highly. Unfortunately, as far as I have been able to tell, every single one of those answers is a variant of "You don't, it's bad…
Benubird
  • 18,551
  • 27
  • 90
  • 141
-3
votes
1 answer

Not able to update a value in JLabel filed .. in second frame while clicking a button on first frame

I have two windows opened at the same time ,so now on clicking a Jbutton in first window frame My Jlabel value should get updated or change in second window frame.... My problem is I am using observer pattern in my case code is working pretty fine I…
-3
votes
0 answers

Code not executed in expected order?

Can someone please explain to me why the code via the link below isn't getting executed as expected? I think I'm ignorant to something about how threads execute but obviously I don't know what. any assistance is greatly appreciated. Visually, I'm…
cjayem13
  • 903
  • 10
  • 24
1 2 3
54
55