OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.lang/] [Thread_HoldsLock.java] - Blame information for rev 765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 765 jeremybenn
// Test that Thread.holdsLock() works.
2
 
3
class Lock {}
4
 
5
public class Thread_HoldsLock
6
{
7
  static Lock lock = new Lock();
8
 
9
  public static void main(String args[]) throws InterruptedException
10
  {
11
    Thread_HoldsLock thl = new Thread_HoldsLock();
12
 
13
    thl.check();
14
    synchronized (lock)
15
      {
16
        thl.check();
17
      }
18
    thl.check();
19
  }
20
 
21
  public void check()
22
  {
23
    Thread this_thread = Thread.currentThread();
24
    System.out.println(this_thread.holdsLock(lock));
25
  }
26
}
27
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.