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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 1.1.4, 1.2.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86, sparc
    • OS:
      solaris_2.5.1, windows_nt

      Description



      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)
      ======================================================================

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: