Stop Thread - Online Code


This code defines a safe way of stopping a thread.

Source Code

package yfrindia;

import java.util.Timer;
import java.util.TimerTask;

class CanStop extends Thread {
  private volatile boolean stop = false;

  private int counter = 0;

  public void run() {
... (login or register to view full code)

To view full code, you must Login or Register, its FREE.

Hey, registering yourself just takes less than a minute and opens up a whole new GetGyan experience.


No comment yet. Be the first to post a comment.