1.使用状态位,这个简单,就不多说了:
#div_code img{border:0px;}
public class Task extends Thread {
private volatile boolean flag= true;
public void stopTask() {
flag = false;
}
@Override
public void run() {
while(flag){
/* do your no-block task */
}
}
}