Java: Difference in usage between Thread.interrupted() and Thread.isInterrupted()?

后端 未结 9 703
南旧
南旧 2020-12-12 16:28

Java question: As far as I know, there are two ways to check inside a thread whether the thread received an interrupt signal, Thread.interrupted() and Thr

9条回答
  •  执笔经年
    2020-12-12 16:45

    If you use interrupted, what you're asking is "Have I been interrupted since the last time I asked?"

    isInterrupted tells you whether the thread you call it on is currently interrupted.

提交回复
热议问题