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
Link to this function
child_spec(arg) View Source
Returns a specification to start this module under a supervisor.
See Supervisor
.
Link to this function
delete(name) View Source
Removes the queue from memory, killing its process.
Link to this function
new(name) View Source
Creates a new First In, First Out queue using Erlang's :queue
Examples
{:ok, pid} = Queue.new(:my_queue)
Link to this function
pop(name) View Source
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
Link to this function
push(name, item) View Source
Adds an item to the queue.
Examples
iex> Queue.new(:my_queue)
iex> Queue.push(:my_queue, 1)
:ok
Link to this function
queue(name) View Source
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]