worker

package
Version: v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package worker provides background worker tasks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Worker

type Worker struct {
	sync.WaitGroup
	// contains filtered or unexported fields
}

Worker is a set of managed background go routines.

func (*Worker) Go

func (w *Worker) Go(fn func())

Go excutes the function fn in a new Go routine. Multiple Go routines may be started under the same Worker. It is the function's responsibility to monitor the channel returned by `Worker.HaltCh()` and to return.

func (*Worker) Halt

func (w *Worker) Halt()

Halt signals all Go routines started under a Worker to terminate, and waits till all go routines have returned.

func (*Worker) HaltCh

func (w *Worker) HaltCh() <-chan interface{}

HaltCh returns the channel that will be closed on a call to Halt.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL