Quantcast
Channel: Comments on: 线程管理(四)操作线程的中断机制
Browsing latest articles
Browse All 7 View Live

作者:fangqiang08

Thread和 Thread.currentThread有什么区别啊?

View Article



作者:方 腾飞

Thread.currentThread 获取当前线程的实例。 Thread 是个线程类。

View Article

作者:hom_

请问文章是不是没写全的?

View Article

作者:shangshicc

请问为什么在这个程序中用interrupted()方法判断是否中断,而不是用isInterrupted(),是有什么特殊的原因吗?

View Article

作者:duqi

我的理解是没有,暂时也不清楚如何选择

View Article


作者:duqi

想了下,应该是这个原因:interrupted()方法是静态方法,isInterrupted()是实例方法,在这个例子中FileSearch是实现了Runnable接口,因此只能通过Thread调用它的实例方法;如果使用extends(继承),让FileSearch继承Thread类的话,就可以使用isInterrupted()方法了

View Article

By: 雁过留影

或者用Thread.currentThread()获取当前线程,再调用isInterrupted()来获取状态

View Article
Browsing latest articles
Browse All 7 View Live




Latest Images