X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=libjava%2Ftestsuite%2Flibjava.lang%2FThread_Monitor.java;fp=libjava%2Ftestsuite%2Flibjava.lang%2FThread_Monitor.java;h=0000000000000000000000000000000000000000;hb=6fed43773c9b0ce596dca5686f37ac3fc0fa11c0;hp=f1ffa674c37278e2fec62223755170e6d99f608f;hpb=27b11d56b743098deb193d510b337ba22dc52e5c;p=msp430-gcc.git diff --git a/libjava/testsuite/libjava.lang/Thread_Monitor.java b/libjava/testsuite/libjava.lang/Thread_Monitor.java deleted file mode 100644 index f1ffa674..00000000 --- a/libjava/testsuite/libjava.lang/Thread_Monitor.java +++ /dev/null @@ -1,65 +0,0 @@ -// Test that monitor locks work and are recursive. -// Origin: Bryce McKinlay - -class T implements Runnable -{ - public int count = 0; - Counter c; - - public T (Counter c) - { - this.c = c; - } - - public void run() - { - while (true) - { - // NOTE: double-synchronization here. - synchronized (c) - { - if (c.getCount() <= 100000) - count++; - else - break; - } - } - } -} - -class Counter -{ - int i = 0; - public synchronized int getCount () - { - return ++i; - } -} - -public class Thread_Monitor -{ - public static void main(String args[]) - { - Counter c = new Counter(); - T t1 = new T(c); - T t2 = new T(c); - - Thread th1 = new Thread(t1); - Thread th2 = new Thread(t2); - th1.start(); - th2.start(); - try - { - th1.join(); - th2.join(); - } - catch (InterruptedException x) - { - System.out.println("failed: Interrupted"); - } - if (t1.count + t2.count == 100000) - System.out.println ("ok"); - else - System.out.println ("failed: total count incorrect"); - } -}