public static void trigger() {
   syncInterrupt.lock();
   if (allowInterrupt) {
     myThread.interrupt();
   } else {
     triggered = true;
   }
   syncInterrupt.unlock();
 }
Ejemplo n.º 2
0
 public static void main(String[] args) {
   ThreadInterruptDemo test = new ThreadInterruptDemo();
   MyThread thread = test.new MyThread();
   thread.start();
   try {
     Thread.currentThread().sleep(2000);
   } catch (InterruptedException e) {
     e.printStackTrace();
   }
   thread.interrupt();
 }
Ejemplo n.º 3
0
 @Override
 public void surfaceDestroyed(SurfaceHolder holder) {
   mThread.interrupt();
 }