q

package module
v0.0.0-...-b5a66dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2015 License: BSD-2-Clause Imports: 1 Imported by: 1

README

q

q is a queue used to concurrently process jobs.

// buffer size for the queue to hold jobs on. 
Queue = q.New(buff)

Returns a new q.Queue.

// n is the number of workers which will
Queue.Start(n)

Initializes the workers, now the Queue is ready to start processing jobs.

// j is a Job, anything which implements the Run() method
Queue.Push(j)

Pushes jobs onto the queue. A Job is anything thing that implements Run() which is responsible for Processing the job.

If you want to halt the Queue to prevent an additional jobs from being processed Queue.Quit <- true will halt the queue. However after the Queue has halted any Jobs that were processing will complete.

Q

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job interface {
	Run()
}

type Queue

type Queue struct {
	Quit chan bool
	// contains filtered or unexported fields
}

func New

func New(buff int) Queue

func (*Queue) Push

func (q *Queue) Push(j Job)

func (*Queue) Start

func (q *Queue) Start(n int)

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL