How to pause a thread in java?
Posted
by mithun1538
on Stack Overflow
See other posts from Stack Overflow
or by mithun1538
Published on 2010-03-29T12:12:17Z
Indexed on
2010/03/29
12:23 UTC
Read the original article
Hit count: 354
Consider the following code:
while(true) { someFunction(); Thread.sleep(1000); }
What I want is that, someFunction() be called once every 10 seconds. But this is not the case. It is being called every second. I tried Thread.wait(1000), but even that doesnt help. I removed of the while part, just kept the body, and at the end wrote :
Thread.start();
But it throwed an exception. Is there any other solution to this?
© Stack Overflow or respective owner