<<< Starting Runnable interface thread example | Index | Thread interruption - InterruptedException >>> |
The CPU automatically interrupts itself all the time to implement the OS thread scheduler
The Java interruption mechanism wakes up a waiting or sleeping thread
If the interrupted thread is not in a blocking call, then:
(a) interrupt() sets the interrupted flag
(b) as soon as the thread makes a blocking call such as Thread.sleep(), InterruptedException is thrown immediately
<<< Starting Runnable interface thread example | Index | Thread interruption - InterruptedException >>> |