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

fp.bugs 2027: Win32 only: can call thread.wait() outside of monitor

    XMLWordPrintable

Details

    • 1.0beta2
    • x86
    • windows_nt
    • Verified

    Description

      ###@###.###

      Can call thread.wait() outside of monitor, does not give InternalError message monitorNotify().

      Steps to reproduce:
      Compile and the following java code
      run java TwoThreadsTest on Win32
      // compare with results on Solaris

      class TwoThreadsTest {
      public static void main (String args[])
      {
          SimpleThread s1 = new SimpleThread("Jamaica");
      BigThread s2 = new BigThread("Fiji", s1);

      s1.start();
      s2.start();
          }
      }

      class SimpleThread extends Thread
      {
      public SimpleThread(String str)
      {
      super(str);
      }

      public synchronized void run()
      {
      System.out.println(getName() + ".run()");
      System.out.println(getName() + " waiting");

      try
      {
      this.wait(); // note: this line should cause an InteralError() exception
           }
      catch (InterruptedException e) {}

      System.out.println(getName() + ".interrupted");
      }

      }

      class BigThread extends Thread
      {
      Thread waitingThread;
      public BigThread(String name, Thread t)
      {
      super(name);
      waitingThread = t;
      }

      public void run()
      {
      System.out.println(getName() + ".run()");

      try
      {
      sleep(3000);
           }
      catch (InterruptedException e) {}

      System.out.println(getName() + " " + waitingThread.getName() + ".interrupt()");
      waitingThread.notify();

      waitingThread = null;
      }
      }

      Attachments

        Activity

          People

            dconnellsunw David Connelly (Inactive)
            kasmithsunw Kevin Smith (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: