Queue (fnord v0.1.0)
A module that implements a process pool using a GenServer.
Summary
Functions
Returns a specification to start this module under a supervisor.
Callback implementation for GenServer.init/1
.
Waits until the queue is empty and all workers have exited.
Queues an Enum of jobs, executes them, and returns the results in order.
Adds a job to the queue and returns a Task.
Shuts down the queue, preventing new jobs from being added.
Starts the Queue with the given callback function and maximum number of workers.
Functions
child_spec(init_arg)
Returns a specification to start this module under a supervisor.
See Supervisor
.
init(arg)
Callback implementation for GenServer.init/1
.
join()
Waits until the queue is empty and all workers have exited.
map(enum)
Queues an Enum of jobs, executes them, and returns the results in order.
queue(args)
Adds a job to the queue and returns a Task.
shutdown()
Shuts down the queue, preventing new jobs from being added.
start_link(max_workers, callback)
Starts the Queue with the given callback function and maximum number of workers.