Queue v0.1.0 Queue View Source

Queue is a wrapper around Erlang :queue

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor

Removes the queue from memory, killing its process

Creates a new First In, First Out queue using Erlang's :queue

Pops the oldest item off of the queue

Adds an item to the queue

Displays the queue as a list, with oldest item last

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Removes the queue from memory, killing its process.

Creates a new First In, First Out queue using Erlang's :queue

Examples

{:ok, pid} = Queue.new(:my_queue)

Pops the oldest item off of the queue.

Examples

iex> Queue.new(:my_queue)
iex> Queue.push(:my_queue, 1)
iex> Queue.push(:my_queue, 2)
iex> Queue.pop(:my_queue)
1

Adds an item to the queue.

Examples

iex> Queue.new(:my_queue)
iex> Queue.push(:my_queue, 1)
:ok

Displays the queue as a list, with oldest item last.

Examples

iex> Queue.new(:my_queue)
iex> Queue.push(:my_queue, 1)
iex> Queue.push(:my_queue, 2)
iex> Queue.queue(:my_queue)
[2,1]