How can I restart a thread EXACTLY every 0.5 seconds or quicker?
Printable View
How can I restart a thread EXACTLY every 0.5 seconds or quicker?
Not sure how/if its possible to restart a Thread that is currently running. And if it has stopped running by exiting, I don't know if you can use it again. If the Thread calls wait() before the .5 second limit, then you could use notify() to restart the thread. The notify could be called using a Timer.
Write a test program and see what happens.Quote:
is it going to
You can't. The best you can do is run a Timer with a firing interval somethng less than 0.5 seconds -- maybe 0.4 seconds -- and hope it will never exceed 0.5 seconds.
Why do you have such an odd requirement in the first place? The context may suggest a better solution.
db