gpool

package
v7.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultCleanIntervalTime is the interval time to clean up goroutines.
	DefaultCleanIntervalTime = 5 * time.Second

	// OPENED represents that the pool is opened.
	OPENED = iota

	// CLOSED represents that the pool is closed.
	CLOSED
)

Variables

View Source
var (
	// ErrPoolClosed will be returned when submitting task to a closed pool.
	ErrPoolClosed = errors.New("this pool has been closed")

	// ErrPoolOverload will be returned when the pool is full and no workers available.
	ErrPoolOverload = errors.New("too many goroutines blocked on submit or Nonblocking is set")

	// ErrProducerClosed will be returned when the producer is closed.
	ErrProducerClosed = errors.New("this producer has been closed")
)

Functions

func NewSpinLock

func NewSpinLock() sync.Locker

NewSpinLock instantiates a spin-lock.

Types

type BasePool

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

BasePool is base class of pool

func NewBasePool

func NewBasePool() BasePool

NewBasePool is to create a new BasePool.

func (*BasePool) LastTunerTs

func (p *BasePool) LastTunerTs() time.Time

LastTunerTs returns the last time when the pool was tuned.

func (*BasePool) Name

func (p *BasePool) Name() string

Name is to get name.

func (*BasePool) NewTaskID

func (p *BasePool) NewTaskID() uint64

NewTaskID is to get a new task ID.

func (*BasePool) SetLastTuneTs

func (p *BasePool) SetLastTuneTs(t time.Time)

SetLastTuneTs sets the last time when the pool was tuned.

func (*BasePool) SetName

func (p *BasePool) SetName(name string)

SetName is to set name.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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