Class FastBlockingQueue<T>

java.lang.Object
edu.berkeley.cs.jqf.instrument.util.FastBlockingQueue<T>

public final class FastBlockingQueue<T> extends Object
A blocking queue for single-producer and single-consumer where the producer and consumer never change and are distinct threads. This allows reading and writing from the queue without using system locks. The only synchronization is via volatile pointers for the producer and consumer in a fixed-size circular buffer. Reading from an empty queue and writing to a full queue results in a spinning wait, and therefore the producer and consumer must be distinct in order to avoid deadlocks.
Author:
Rohan Padhye
  • Constructor Details

    • FastBlockingQueue

      public FastBlockingQueue(int size)
  • Method Details

    • isEmpty

      public final boolean isEmpty()
    • isFull

      public final boolean isFull()
    • put

      public final void put(T item)
    • remove

      public final T remove(long timeout)