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 */ 013 package org.mmtk.vm; 014 015 import org.vmmagic.pragma.Uninterruptible; 016 017 /** 018 * Simple, fair locks with deadlock detection. 019 */ 020 @Uninterruptible 021 public abstract class Lock { 022 023 /** 024 * Set the name of this lock instance 025 * 026 * @param str The name of the lock (for error output). 027 */ 028 public abstract void setName(String str); 029 030 /** 031 * Try to acquire a lock and spin-wait until acquired. 032 */ 033 public abstract void acquire(); 034 035 /** 036 * Perform sanity checks on the lock. For debugging. 037 * 038 * @param w Identifies the code location in the debugging output. 039 */ 040 public abstract void check(int w); 041 042 /** 043 * Release the lock by incrementing serving counter. 044 */ 045 public abstract void release(); 046 }