1 // Test that monitor locks work and are recursive.
3 class T
implements Runnable
17 // NOTE: double-synchronization here.
20 if (c
.getCount() <= 100000)
32 public synchronized int getCount ()
38 public class Thread_Monitor
40 public static void main(String args
[])
42 Counter c
= new Counter();
46 Thread th1
= new Thread(t1
);
47 Thread th2
= new Thread(t2
);
55 catch (InterruptedException x
)
57 System
.out
.println("failed: Interrupted");
59 if (t1
.count
+ t2
.count
== 100000)
60 System
.out
.println ("ok");
62 System
.out
.println ("failed: total count incorrect");