routine

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: Apache-2.0 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 {
	// contains filtered or unexported fields
}

Pool accept the tasks from client,it limits the total of goroutines to a given number by recycling goroutines.

func NewPool

func NewPool(size, expiry int) (*Pool, error)

NewPool generates a instance of ants pool

func (*Pool) ReSize

func (p *Pool) ReSize(size int)

动态扩容或者缩小池容量 ReSize change the capacity of this pool

func (*Pool) Submit

func (p *Pool) Submit(task functinType, str interface{}) error

Submit submit a task to pool

type Worker

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

Worker is the actual executor who runs the tasks, it starts a goroutine that accepts tasks and performs function calls.

Jump to

Keyboard shortcuts

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