diff options
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 5 | ||||
-rw-r--r-- | libjava/testsuite/libjava.lang/Thread_HoldsLock.java | 27 | ||||
-rw-r--r-- | libjava/testsuite/libjava.lang/Thread_HoldsLock.out | 3 |
3 files changed, 35 insertions, 0 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index ce46e07..2ad34fa 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,5 +1,10 @@ 2004-07-27 Bryce McKinlay <mckinlay@redhat.com> + * testsuite/libjava.lang/Thread_HoldsLock.java: New test case. + * testsuite/libjava.lang/Thread_HoldsLock.out: New. + +2004-07-27 Bryce McKinlay <mckinlay@redhat.com> + * java/io/File.java (toURI): Throw RuntimeException, not InternalError. * java/lang/Runtime.java (exit): Qualify static sleep() call with diff --git a/libjava/testsuite/libjava.lang/Thread_HoldsLock.java b/libjava/testsuite/libjava.lang/Thread_HoldsLock.java new file mode 100644 index 0000000..3a46466 --- /dev/null +++ b/libjava/testsuite/libjava.lang/Thread_HoldsLock.java @@ -0,0 +1,27 @@ +// Test that Thread.holdsLock() works. + +class Lock {} + +public class Thread_HoldsLock +{ + static Lock lock = new Lock(); + + public static void main(String args[]) throws InterruptedException + { + Thread_HoldsLock thl = new Thread_HoldsLock(); + + thl.check(); + synchronized (lock) + { + thl.check(); + } + thl.check(); + } + + public void check() + { + boolean held = Thread.currentThread().holdsLock(lock); + System.out.println(held); + } +} + diff --git a/libjava/testsuite/libjava.lang/Thread_HoldsLock.out b/libjava/testsuite/libjava.lang/Thread_HoldsLock.out new file mode 100644 index 0000000..eed4037 --- /dev/null +++ b/libjava/testsuite/libjava.lang/Thread_HoldsLock.out @@ -0,0 +1,3 @@ +false +true +false |