Class BlockingQueue<Element>

enqueue blocks when the queue is full, until an item is read with dequeue, or done dequeue blocks when the queue is empty, until an item is added with enqueue, or done done must be called when no more items will be added dequeue returns undefined there are no more items and processing is complete

Type Parameters

  • Element

Hierarchy

Constructors

Properties

_doneAdding: boolean = false
_options: Required<BlockingQueueOptions>
_readersWaiting: Queue<WaiterResolverFunc> = ...
_unreadQueue: Queue<Element> = ...
_writersWaiting: Queue<WaiterResolverFunc> = ...

Accessors

Methods

  • Gets an element when one is ready, waits if none are ready.

    Returns Promise<undefined | Element>

    Element or undefined if queue is empty and done has been called

  • Indicate that no more items will be enqueued.

    This releases all readers blocked on enqueue

    Returns void

  • Add an item to the queue, wait if the queue is full.

    Parameters

    • item: Element

      Element to add

    Returns Promise<void>

  • Waits to be able to add an item to the queue when full

    Returns Promise<void>

  • Waits for an item to be ready in the queue

    Returns Promise<void>

Generated using TypeDoc