1 // Test that monitor locks work and are recursive.
2 // Origin: Bryce McKinlay <bryce@albatross.co.nz>
4 class T implements Runnable
18 // NOTE: double-synchronization here.
21 if (c.getCount() <= 100000)
33 public synchronized int getCount ()
39 public class Thread_Monitor
41 public static void main(String args[])
43 Counter c = new Counter();
47 Thread th1 = new Thread(t1);
48 Thread th2 = new Thread(t2);
56 catch (InterruptedException x)
58 System.out.println("failed: Interrupted");
60 if (t1.count + t2.count == 100000)
61 System.out.println ("ok");
63 System.out.println ("failed: total count incorrect");