+ 25

What is the difference between sleep, wait and suspend in multi-threading?

15th Feb 2018, 8:33 PM
A͢J
A͢J - avatar
2 Answers
+ 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
16th Feb 2018, 4:11 AM
manish singh
manish singh - avatar
+ 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.
15th Feb 2018, 8:54 PM
LunarCoffee
LunarCoffee - avatar