From 0954f3eb52a24fd8c77a298c8f4967a7b26b5b8b Mon Sep 17 00:00:00 2001 From: Bryce McKinlay Date: Tue, 27 Jul 2004 22:04:37 +0000 Subject: [PATCH] Thread_HoldsLock.java: New test case. 2004-07-27 Bryce McKinlay * testsuite/libjava.lang/Thread_HoldsLock.java: New test case. * testsuite/libjava.lang/Thread_HoldsLock.out: New. From-SVN: r85234 --- libjava/ChangeLog | 5 ++++ .../libjava.lang/Thread_HoldsLock.java | 27 +++++++++++++++++++ .../libjava.lang/Thread_HoldsLock.out | 3 +++ 3 files changed, 35 insertions(+) create mode 100644 libjava/testsuite/libjava.lang/Thread_HoldsLock.java create mode 100644 libjava/testsuite/libjava.lang/Thread_HoldsLock.out diff --git a/libjava/ChangeLog b/libjava/ChangeLog index ce46e07bdf6..2ad34fae6e4 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2004-07-27 Bryce McKinlay + + * testsuite/libjava.lang/Thread_HoldsLock.java: New test case. + * testsuite/libjava.lang/Thread_HoldsLock.out: New. + 2004-07-27 Bryce McKinlay * java/io/File.java (toURI): Throw RuntimeException, not diff --git a/libjava/testsuite/libjava.lang/Thread_HoldsLock.java b/libjava/testsuite/libjava.lang/Thread_HoldsLock.java new file mode 100644 index 00000000000..3a46466cb13 --- /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 00000000000..eed403754b0 --- /dev/null +++ b/libjava/testsuite/libjava.lang/Thread_HoldsLock.out @@ -0,0 +1,3 @@ +false +true +false -- 2.30.2