楼上的说的很有点像我的程序,我也是这么怀疑的,但是我怎么退出新的线程呢?
stop()? destroy()?我不太清楚,好像都不行

解决方案 »

  1.   

    有没有wait(),notify()什么的?会不会死锁?
      

  2.   

    那个新线程应该是这样的:
    class YourThread extends Thread {
        private boolean stop = false;    public synchronized void terminate() {
            stop = true;
        }
        
        public void run() {
            while (!stop) {
                ...
            }
        }
        
        ...
    }在你需要结束该线程的时候就调它的terminate()
      

  3.   

    如果有任何non-daemon线程还在执行,主程序就不会终止