pool

package
v0.0.0-...-f9738e6 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(conf *config.Pool, watcher config.Watcher)

Types

type Pool

type Pool interface {
	Go(runner Runner) error
}

func Instance

func Instance() Pool

type Runner

type Runner interface {
	Run() error
	Ctx() context.Context
}

func BgRunner

func BgRunner(fn func() error) Runner

func NewRunner

func NewRunner(ctx context.Context, fn func() error) Runner

type WaitRunner

type WaitRunner interface {
	AddTasks(ctx context.Context, f ...func() error)
	AddTask(ctx context.Context, f func() error)
	Wait()
}

func NewWaitRunner

func NewWaitRunner(opts ...WaitRunnerOptionFunc) WaitRunner

NewWaitRunner 创建等待协程任务

type WaitRunnerOption

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

type WaitRunnerOptionFunc

type WaitRunnerOptionFunc func(o *WaitRunnerOption)

func WithWaitRunnerOption

func WithWaitRunnerOption(max int32) WaitRunnerOptionFunc

Jump to

Keyboard shortcuts

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