Michael Thome wrote:
>
> For your reading pleasure, enclosed below is the current version of my
> test case. It is pretty easy to cut it down to smaller examples,
> especially if you are just looking for the Exception cases. All that
> appears to be required is tight-loop lock contention with wait/notify
> involved running on a native-threaded VM on an SMP machine (phew!).
>
> public class Bang {
> static class Variable {
> private int x = -1;
> private Object lock = new Object();
> public void set(int y) {
> synchronized (lock) {
> x=y;
> System.err.print("."); // do we hang completely?
> lock.notifyAll();
> }
> }
> public void print(String who) {
> synchronized (lock) {
> try {
> lock.wait();
> } catch (InterruptedException e) {}
> System.err.println(who+" sees "+x);
> }
> }
> }
> Variable v = new Variable();
> class Thrash implements Runnable {
> int i;
> public Thrash(int i) { this.i = i; }
> public void run() {
> for (;;) {
> v.set(i);
> }
> }
> }
> class Watch implements Runnable {
> String who;
> public Watch(String who) { this.who = who; }
> public void run() {
> for (;;) {
> v.print(who);
> }
> }
> }
> void start(int l) {
> for (int i=0; i<l; i++) {
> new Thread(new Thrash(i)).start();
> }
> new Thread(new Watch("first")).start();
> new Thread(new Watch("second")).start();
> }
>
> public static void main(String[] arg) {
> (new Bang()).start(10);
> }
> }
>
Exactly what is the problem with that?
I have it running for the last hour or so without any problem (so far).
I have a dual PIII box. uname -r is "2.2.16", java -fullversion is "J2RE
1.3.0 IBM build cx130-20000605" (this is the most recent ibm-1.3
release).
Perhaps it is a sun-jdk only problem.
-- dimitris
mailto:[EMAIL PROTECTED]
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]