What happens when you invoke a thread's interrupt()?
java, multithreading, thread-safety
Solution
Judging by your previous questions, I assume you are interested in Java's behavior.
In Java, an `InterruptedException` will be thrown if the thread is currently blocking. If the thread is not blocking, the exception will not be thrown.
For more information, look here: JavaDocs
For .NET languages, a `ThreadInterruptedException` will be thrown if the thread is currently blocking. If the thread isn't blocking the exception will not be thrown until the thread blocks.
Please tag your question with the language you want an answer for.
Problem
I need to know what happens - when it is sleeping? - when it is running i.e., it is executing the given task. Thanks in advance.