GoPool

package
v0.0.0-...-7f82f8f Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

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

goroutine pool

func FromRunner

func FromRunner(capa int, runner Runner) *Pool

func NewPool

func NewPool(capa int,
	run func() (interface{}, error),
	quit func(*Pool, interface{}, error)) *Pool

func (*Pool) AddExecutor

func (this *Pool) AddExecutor()

add goroutine manual

func (*Pool) AutoKeepalive

func (this *Pool) AutoKeepalive(duration time.Duration)

func (*Pool) Count

func (this *Pool) Count() int

count may great then capa when user AddExecutor

func (*Pool) Keepalive

func (this *Pool) Keepalive() int

check alive

func (*Pool) WaitAllQuit

func (this *Pool) WaitAllQuit()

return after all goroutine quit in pool

type Runner

type Runner interface {
	Run() (interface{}, error)
	Quit(*Pool, interface{}, error)
}

Jump to

Keyboard shortcuts

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