xsync

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2021 License: MIT Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

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

func NewGroup

func NewGroup(option ...Option) *Group

NewGroup 创建Group

func (*Group) Go

func (g *Group) Go(f func(context.Context) error)

Go 启动协程并捕获异常 异常退出、panic退出

func (*Group) Wait

func (g *Group) Wait()

type Option

type Option func(group *Group)

func WithContext

func WithContext(ctx context.Context) Option

WithContext 上下文

func WithHandler

func WithHandler(handler func(context.Context)) Option

WithHandler 错误处理

func WithMaxGoNum

func WithMaxGoNum(maxGoNum int64) Option

WithMaxGoNum 限流 至少一个goroutine 全局协程管理限流必须带上ctx超时管理,否则会阻塞

Jump to

Keyboard shortcuts

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