Answer the question
In order to leave comments, you need to log in
Is it possible to interrupt a thread in the Thread List?
I have a Thread List. Each thread executes Runnable. Is it possible during the execution of the first thread to interrupt the execution of, say, the third? If yes, how should it look like?
Answer the question
In order to leave comments, you need to log in
A thread must manage its own lifecycle on its own. The other thread can only send signals to it, changing the shared state. Use a volatile variable or one of the synchronization primitives.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question