pool

package
v0.57.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncPool added in v0.55.0

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

func NewAsyncPool added in v0.55.0

func NewAsyncPool(taskBufferCapacity int, numWorkers int) (*AsyncPool, error)

NewAsyncPool creates a new AsyncPool. taskBufferCapacity is the capacity of the task buffer. numWorkers is the number of workers in the pool.

func (*AsyncPool) AsyncSubmit added in v0.55.0

func (ap *AsyncPool) AsyncSubmit(task Task, onError OnError) error

AsyncSubmit submits a task asynchronously.

If the task buffer is full, it will return an error. If the pool is closed, it will return an error.

Task type: func() error

OnError type: func(error)

func (*AsyncPool) Shutdown added in v0.55.0

func (ap *AsyncPool) Shutdown()

type OnError added in v0.53.0

type OnError func(error)

type Task added in v0.53.0

type Task func() error

type WorkerPool

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

func NewWorkerPool

func NewWorkerPool(numWorkers int) *WorkerPool

func (*WorkerPool) Submit

func (wp *WorkerPool) Submit(task Task, onError OnError)

func (*WorkerPool) TrySubmit

func (wp *WorkerPool) TrySubmit(task Task, onError OnError) bool

Jump to

Keyboard shortcuts

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