gf: github.com/johng-cn/gf/g/os/grpool Index | Files

package grpool

import "github.com/johng-cn/gf/g/os/grpool"

Package grpool implements a goroutine reusable pool.

Index

Package Files

grpool.go

func Add Uses

func Add(f func())

Add pushes a new job to the pool using default goroutine pool. The job will be executed asynchronously.

func Jobs Uses

func Jobs() int

Jobs returns current job count of default goroutine pool.

func Size Uses

func Size() int

Size returns current goroutine count of default goroutine pool.

type Pool Uses

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

Goroutine Pool

func New Uses

func New(limit ...int) *Pool

New creates and returns a new goroutine pool object. The parameter <limit> is used to limit the max goroutine count, which is not limited in default.

func (*Pool) Add Uses

func (p *Pool) Add(f func())

Add pushes a new job to the pool. The job will be executed asynchronously.

func (*Pool) Close Uses

func (p *Pool) Close()

Close closes the goroutine pool, which makes all goroutines exit.

func (*Pool) Jobs Uses

func (p *Pool) Jobs() int

Jobs returns current job count of the pool.

func (*Pool) Size Uses

func (p *Pool) Size() int

Size returns current goroutine count of the pool.

Package grpool imports 2 packages (graph). Updated 2019-06-19. Refresh now. Tools for package owners.