Details
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;
}
}
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;
}
}