+ 25
What is the difference between sleep, wait and suspend in multi-threading?
2 ответов
+ 3
sleep method send the current Thread into non runnable state for a given amount of time , wait() method send thread into non runnable state until called notify or notifyAll for this object , sleep belong to Thread class and wait belong to Object Class , suspend() method suspend thread till called resume on that Thread suspend method is deprecated as it prone to deadlock situatio2
+ 3
Sleep sleeps a thread for a specific amount of time. Suspend stops execution of a thread until it is manually resumed. I don't know what wait does, but you can just use Google for that.