Java SE/Stopping Thread 썸네일형 리스트형 Stopping a Thread Thread를 멈추기 위한 방법 // Create and start the thread MyThread thread = new MyThread(); thread.start(); // Do work... // Stop the thread thread.allDone = true; class MyThread extends Thread { boolean allDone = false; // This method is called when the thread runs public void run() { while (true) { // Do work... if (allDone) { return; } // Do work... } } } 더보기 이전 1 다음