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] - Rev 765

Compare with Previous | Blame | View Log

// 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()
  {
    Thread this_thread = Thread.currentThread();
    System.out.println(this_thread.holdsLock(lock));
  }
}
 
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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