[ANN] PriorityChannels.jl


I’ve created a small package PriorityChannels.jl that implements a PriorityChannel that mimics Base.Channel , but where each element is associated with a priority. take! always returns the highest priority element. Internally, a heap is used to keep track of priorities. Usage example in the readme.

Difference between Channel and PriorityChannel

  • put!(pc, element, priority::Real) lower number indicates a higher priority (default = 0).
  • PriorityChannel can not be unbuffered (of length 0) and must have a positive length.
  • take!(pc) returns the highest priority item, PriorityChannel thus acts like a priority queue instead of a FIFO queue like Channel does
  • Pretty much all other functionality should be the same, including all constructors.


using Pkg
pkg"add PriorityChannels"

Happy New Year, may it be full of wisely prioritized and rewarding tasks!