Sunday, 17 April 2011

What is the difference between yield() and sleep()?

yield() allows the current the thread to release its lock from the object and scheduler gives the lock of the object to the other thread with same priority.
         sleep() allows the thread to go to sleep state for x milliseconds. When a thread goes into sleep state it doesn’t release the lock.

No comments:

Post a Comment