Interface ConcurrentQueue<T>

Type Parameters:
T - the contained type
All Known Subinterfaces:
ConcurrentPriorityQueue<T>
All Known Implementing Classes:
LockFreeArrayQueue

public interface ConcurrentQueue<T>
Common interface for LockFreeArrayQueue and variants.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns null when the queue is empty This method should never block (but it may spin for a finite amount of time)
    boolean
    enqueue(T new_value)
    Returns false when the queue is full This method should never block (but it may spin for a finite amount of time)
    boolean
    enqueue(T new_value, long spins_between_yields)
    Spins forever until the item can be enqueued.
    Return the current next value, or null if the queue is empty.
    void
    put(T new_value)
    Only return when enqueued.
    Only return w/ a dequeued value.
  • Method Details

    • enqueue

      boolean enqueue(T new_value)
      Returns false when the queue is full This method should never block (but it may spin for a finite amount of time)
    • enqueue

      boolean enqueue(T new_value, long spins_between_yields)
      Spins forever until the item can be enqueued. Calls yield() after the number of specified spins.
    • dequeue

      T dequeue()
      Returns null when the queue is empty This method should never block (but it may spin for a finite amount of time)
    • put

      void put(T new_value)
      Only return when enqueued. (Might spin continuously)
    • take

      T take()
      Only return w/ a dequeued value. (Might spin continuously)
    • peek

      T peek()
      Return the current next value, or null if the queue is empty.