1.进入github(也可以进openJDK网站)
https://github.com/openjdk-mirror/jdk7u-jdk
2.点击findfile
3.interrupt()属于Thread这个类,那么对应过来就是Thread.c
4.在Thread.java中interrupt0()这个方法对应到C++里面JVM_Interrupt
5.然后我们拿到这个c++方法去hotspot里面做分析
https://github.com/openjdk-mirror/jdk7u-hotspot
6.在hotspot里找到一个jvm.cpp的类
7.实际是在jvm.cpp这个方法中
8.我们进入Thread.cpp查看interrupt()的实现(也是通过find file)
9.进入Thread.cpp这个类直接 ctrl+f 搜索Thread::interrupt()
10.c++源码
第一个箭头就是设置中断,第二个箭头就是对一些情况进行唤醒比如sleep,所以在sleep()过程中也能响应中断。