I have a metod that when called the first line of code I would like to write is to have the method stall for 10 miliseconds. How can I do this? This is not a thread.
I would just write a loop to stall, but it would finish at different times depending on what CPU is it is executed on.
And to continue Joel's reply there's no way to guarantee a 10 ms sleep since it would mean that you're having exclusive control of the processor. Which Java, nor the OS would allow.
Originally posted by Anthony Smith: I have a metod that when called the first line of code I would like to write is to have the method stall for 10 miliseconds. How can I do this? This is not a thread.
I would just write a loop to stall, but it would finish at different times depending on what CPU is it is executed on.
Every program IS a thread. That is every program has at least ONE thread. So you can still use the methods from the Thread class as illustrated above.