Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4092438

Thread.interrupted()/Thread.isInterrupted() reports wrong value

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 1.1.4, 1.2.0
    • core-libs
    • x86, sparc
    • solaris_2.5.1, windows_nt



      Name: rm29839 Date: 11/12/97


      If you execute the following code, you will see the thread is interrupted, however, Thread.interrupted() will return false

      public class u {
        public static void main(String args[]) {
          Thread t = new Thread() {
            public void run() {
              try {
              synchronized(this) {
                wait();
              }
              } catch(Exception e) {
                e.printStackTrace();
                System.out.println(Thread.interrupted());
              }
            }
          };
          t.start();

          t.interrupt();
          for(;;) {
          }

        }
      }
      (Review ID: 19582)
      ======================================================================

            jjb Josh Bloch
            rmandelsunw Ronan Mandel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: