public class xyz implements Runnable{
public void run(){
while(true){
…… // 执行若干操作
// 给其他线程运行的机会
try{
Thread.sleep(10);
}catch(InterruptedException e){
// 该线程为其他线程所中断
}
}
}
}