What does java.lang.Thread.interrupt() do?

前端 未结 9 2447
日久生厌
日久生厌 2020-11-22 06:01

Could you explain what java.lang.Thread.interrupt() does when invoked?

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-22 06:54

    Thread.interrupt() sets the interrupted status/flag of the target thread to true which when checked using Thread.interrupted() can help in stopping the endless thread. Refer http://www.yegor256.com/2015/10/20/interrupted-exception.html

提交回复
热议问题