Based on the requirements sometimes you might want to suspend, resume or stop a thread. For doing such operations on a thread, before Java 2, thread API used to contain suspend(), resume() and stop() methods. But all these methods might lead to undesired behavior of the program or machine. For example, these methods might lead to deadlock when a thread locked and is accessing a data structure and suddenly it is suspended or stopped. All other threads will be waiting indefinitely for gaining access to the data structure. Because of this drawback of suspend(), resume() and stop() methods, they have been deprecated (should not
The post How to suspend ,resume and stop threads appeared first on Coding Security.
How to suspend ,resume and stop threads
read more
Tidak ada komentar:
Posting Komentar