Thread_HoldsLock.java: New test case.
2004-07-27 Bryce McKinlay <mckinlay@redhat.com> * testsuite/libjava.lang/Thread_HoldsLock.java: New test case. * testsuite/libjava.lang/Thread_HoldsLock.out: New. From-SVN: r85234
This commit is contained in:
parent
e140e27d53
commit
0954f3eb52
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
27
libjava/testsuite/libjava.lang/Thread_HoldsLock.java
Normal file
27
libjava/testsuite/libjava.lang/Thread_HoldsLock.java
Normal file
@ -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);
|
||||
}
|
||||
}
|
||||
|
3
libjava/testsuite/libjava.lang/Thread_HoldsLock.out
Normal file
3
libjava/testsuite/libjava.lang/Thread_HoldsLock.out
Normal file
@ -0,0 +1,3 @@
|
||||
false
|
||||
true
|
||||
false
|
Loading…
Reference in New Issue
Block a user