goroutine

package
v2.9.9 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelayGo

func DelayGo(delay time.Duration, fn func())

DelayGo goroutine

func Go

func Go(fn func())

Go goroutine

func GoDirect

func GoDirect(fn interface{}, args ...interface{})

GoDirect ...

func Parallel

func Parallel(fns ...func()) func()

Parallel 并发执行

func ParallelWithError

func ParallelWithError(fns ...func() error) func() error

ParallelWithError ...

func ParallelWithErrorChan

func ParallelWithErrorChan(fns ...func() error) chan error

ParallelWithErrorChan calls the passed functions in a goroutine, returns a chan of errors. fns会并发执行,chan error

func RestrictParallel

func RestrictParallel(restrict int, fns ...func()) func()

RestrictParallel 并发,最大并发量restrict

func RestrictParallelWithErrorChan

func RestrictParallelWithErrorChan(concurrency int, fns ...func() error) chan error

RestrictParallelWithErrorChan calls the passed functions in a goroutine, limiting the number of goroutines running at the same time, returns a chan of errors.

func SafeGo

func SafeGo(fn func(), rec func(error))

SafeGo safe go

func Serial

func Serial(fns ...func()) func()

Serial 串行

func SerialUntilError

func SerialUntilError(fns ...func() error) func() error

SerialUntilError 创建一个迭代器

func SerialWhenError

func SerialWhenError(we WhenError) func(fn ...func() error) func() error

SerialWhenError ...

func SerialWithError

func SerialWithError(fns ...func() error) func() error

SerialWithError ...

Types

type WhenError

type WhenError int

WhenError 策略注入

var (

	// ReturnWhenError ...
	ReturnWhenError WhenError = 1

	// ContinueWhenError ...
	ContinueWhenError WhenError = 2

	// PanicWhenError ...
	PanicWhenError WhenError = 3

	// LastErrorWhenError ...
	LastErrorWhenError WhenError = 4
)

ReturnWhenError ...

Jump to

Keyboard shortcuts

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