Help us shape the future of Go! Take the 2026 Go Developer Survey

job

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2018 License: Apache-2.0 Imports: 2 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

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

Job represents job

func NewJob

func NewJob(task func()) Job

NewJob creates new Job

func (*Job) Run

func (job *Job) Run()

Run executes one Job

type Queue

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

Queue manages workers and job

func NewQueue

func NewQueue(maxWorker uint) *Queue

NewQueue makes new manager

func (*Queue) Add

func (queue *Queue) Add(job Job)

Add new job

func (*Queue) ForceStop

func (queue *Queue) ForceStop()

ForceStop forces job manager without waiting job complete

func (*Queue) Stop

func (queue *Queue) Stop()

Stop stops all worker after all job get done

func (*Queue) Wait

func (queue *Queue) Wait()

Wait until all job get done

type Worker

type Worker struct {
	CloseCh chan bool
	// contains filtered or unexported fields
}

Worker subcribes manager's work queue and execute it

func NewWorker

func NewWorker(queue *Queue) *Worker

NewWorker makes new working process

func (*Worker) Start

func (worker *Worker) Start()

Start consuming task

Jump to

Keyboard shortcuts

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