Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Thread.Sleep()

807589Sep 2 2008 — edited Sep 4 2008
Hi,
I have a threading doubt.
When we say:
Thread.Sleep(5000);
Is it guaranteed that the thread would sleep for 5sec? From what I know, the JVM is free to wake up any thread anytime it wants. So the above line of code does not necessarily guarantee that the thread would sleep. It would in most of the cases, but it is still not guaranteed.
Am I right? Any insights into this?
Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 2 2008
Added on Sep 2 2008
12 comments
281 views