001/* 002 * This file is part of the Jikes RVM project (http://jikesrvm.org). 003 * 004 * This file is licensed to You under the Eclipse Public License (EPL); 005 * You may not use this file except in compliance with the License. You 006 * may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/eclipse-1.0.php 009 * 010 * See the COPYRIGHT.txt file distributed with this work for information 011 * regarding copyright ownership. 012 */ 013package org.jikesrvm.mm.mmtk; 014 015import org.vmmagic.pragma.Uninterruptible; 016 017/** 018 * Provides MMTk access to a heavy lock with condition variable. 019 * Functionally similar to Java monitors, but safe in the darker corners of runtime code. 020 */ 021@Uninterruptible 022public final class Monitor extends org.mmtk.vm.Monitor { 023 024 private final org.jikesrvm.scheduler.Monitor theLock; 025 026 public Monitor(String name) { 027 this.theLock = new org.jikesrvm.scheduler.Monitor(); 028 } 029 030 @Override 031 public void lock() { 032 theLock.lockNoHandshake(); 033 } 034 035 @Override 036 public void unlock() { 037 theLock.unlock(); 038 } 039 040 @Override 041 public void await() { 042 theLock.waitNoHandshake(); 043 } 044 045 @Override 046 public void broadcast() { 047 theLock.broadcast(); 048 } 049}