我看到这一点:这样好吗?同步(线程),那么线程= NULL在同步块
// thread is a member of this class
synchronized(this.thread)
{
this.thread.running = false;
this.thread.notifyAll(); // Wake up anything that was .waiting() on
// the thread
this.thread = null; // kill this thread reference.
// can you do that in a synchronized block?
}
它是确定设置thread=null
,同时仍保持对锁吗?
我发现这个块有点BB代码。
是否有任何理由你没有使用Thread.interrupt(),因为这是由底层库支持的? – 2010-11-19 17:51:26