upool

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTaskPoolClosed error = errors.New("task_pool already closed")
)

Functions

This section is empty.

Types

type LogLevel added in v1.0.0

type LogLevel uint8
const (
	DebugLevel LogLevel = iota
	InfoLevel
	WarnLevel
	ErrorLevel
	FatalLevel
	PanicLevel
)

func (LogLevel) GetType added in v1.0.0

func (ll LogLevel) GetType() string

type TaskHandler

type TaskHandler interface {
	Execute()
}

type TaskOption added in v1.0.0

type TaskOption struct {
	RecoverHandler func(interface{})
	LogLevel       LogLevel
	IdleTime       int // seconds
}

type TaskPool

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

func NewTaskPool

func NewTaskPool(capacity int, options ...TaskOption) *TaskPool

func (*TaskPool) Put

func (tp *TaskPool) Put(task TaskHandler) error

func (*TaskPool) Wait added in v0.1.2

func (tp *TaskPool) Wait()

func (*TaskPool) WaitAndClose added in v1.0.0

func (tp *TaskPool) WaitAndClose()

Jump to

Keyboard shortcuts

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