-2

I know how to interrupt a thread. But I want to know how interrupt method works internally in java multi threading ?

Pshemo
  • 122,468
  • 25
  • 185
  • 269
Sanjeev
  • 153
  • 1
  • 10
  • The best way is to read the code. In simple terms it sets a volatile boolean however it can also cause blocking operations to throw Exceptions. – Peter Lawrey Jul 19 '18 at 17:45

1 Answers1

0

Here's a simplistic answer. If the thread is in a wait condition, an InterruptedException is thrown. If the thread is active, the thread's interrupted flag is set.

Steve11235
  • 2,849
  • 1
  • 17
  • 18