org.mmtk.vm
Class SynchronizedCounter

java.lang.Object
  extended by org.mmtk.vm.SynchronizedCounter
Direct Known Subclasses:
SynchronizedCounter

public abstract class SynchronizedCounter
extends Object

A counter that supports atomic increment and reset.


Constructor Summary
SynchronizedCounter()
           
 
Method Summary
abstract  int increment()
          Adds 1 to the counter.
abstract  int peek()
          Peek at the counter
abstract  int reset()
          Reset the counter to 0, returning its previous value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynchronizedCounter

public SynchronizedCounter()
Method Detail

reset

public abstract int reset()
Reset the counter to 0, returning its previous value.

Returns:
The value of the counter, prior to reset.

increment

public abstract int increment()
Adds 1 to the counter.

Returns:
the value before the add

peek

public abstract int peek()
Peek at the counter

Returns:
The current value of the counter.