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    /**
019     * A counter that supports atomic increment and reset.
020     */
021    @Uninterruptible public abstract class SynchronizedCounter {
022    
023      /**
024       * Reset the counter to 0, returning its previous value.
025       *
026       * @return The value of the counter, prior to reset.
027       */
028      public abstract int reset();
029    
030      /**
031       * Adds 1 to the counter.
032       *
033       * @return the value before the add
034       */
035      public abstract int increment();
036    
037      /**
038       * Peek at the counter
039       *
040       * @return The current value of the counter.
041       */
042      public abstract int peek();
043    }