-2

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

Pshemo
  • 118,400
  • 24
  • 176
  • 257
Sanjeev
  • 123
  • 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,781
  • 1
  • 16
  • 18