src/java.base/share/classes/java/lang/Thread.java
changeset 49108 b9ee7c274ee0
parent 49001 ce06058197a4
child 49203 3a225d9cabe1
equal deleted inserted replaced
49107:8d30b4960828 49108:b9ee7c274ee0
  1005      *
  1005      *
  1006      * @revised 6.0
  1006      * @revised 6.0
  1007      * @spec JSR-51
  1007      * @spec JSR-51
  1008      */
  1008      */
  1009     public void interrupt() {
  1009     public void interrupt() {
  1010         Thread me = Thread.currentThread();
  1010         if (this != Thread.currentThread()) {
  1011         if (this != me)
       
  1012             checkAccess();
  1011             checkAccess();
  1013 
  1012 
  1014         // set interrupt status
  1013             // thread may be blocked in an I/O operation
  1015         interrupt0();
       
  1016 
       
  1017         // thread may be blocked in an I/O operation
       
  1018         if (this != me && blocker != null) {
       
  1019             synchronized (blockerLock) {
  1014             synchronized (blockerLock) {
  1020                 Interruptible b = blocker;
  1015                 Interruptible b = blocker;
  1021                 if (b != null) {
  1016                 if (b != null) {
       
  1017                     interrupt0();  // set interrupt status
  1022                     b.interrupt(this);
  1018                     b.interrupt(this);
       
  1019                     return;
  1023                 }
  1020                 }
  1024             }
  1021             }
  1025         }
  1022         }
       
  1023 
       
  1024         // set interrupt status
       
  1025         interrupt0();
  1026     }
  1026     }
  1027 
  1027 
  1028     /**
  1028     /**
  1029      * Tests whether the current thread has been interrupted.  The
  1029      * Tests whether the current thread has been interrupted.  The
  1030      * <i>interrupted status</i> of the thread is cleared by this method.  In
  1030      * <i>interrupted status</i> of the thread is cleared by this method.  In