Class: Concurrent::PriorityQueue

Inherits:
MutexPriorityQueue show all
Defined in:
lib/concurrent/collection/priority_queue.rb,
lib/concurrent/collection/priority_queue.rb

Overview

Note:

This implementation is not thread safe and performs no blocking.

A queue collection in which the elements are sorted based on their comparison (spaceship) operator ‘<=>`. Items are added to the queue at a position relative to their priority. On removal the element with the “highest” priority is removed. By default the sort order is from highest to lowest, but a lowest-to-highest sort order can be set on construction.

The API is based on the Queue class from the Ruby standard library.

The pure Ruby implementation, MutexPriorityQueue uses a heap algorithm stored in an array. The algorithm is based on the work of Robert Sedgewick and Kevin Wayne.

The JRuby native implementation is a thin wrapper around the standard library java.util.PriorityQueue.

When running under JRuby the class PriorityQueue extends JavaPriorityQueue. When running under all other interpreters it extends MutexPriorityQueue.

Method Summary

Methods inherited from MutexPriorityQueue

#clear, #delete, #empty?, from_list, #include?, #initialize, #length, #peek, #pop, #push

Constructor Details

This class inherits a constructor from Concurrent::MutexPriorityQueue