waitgroup

package
v0.0.0-...-7f0eed6 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WaitGroup

type WaitGroup struct {
	sync.WaitGroup
}

WaitGroup is a wrapper for sync.WaitGroup

func (*WaitGroup) Run

func (w *WaitGroup) Run(exec func())

Run runs a function in a goroutine, adds 1 to WaitGroup and calls done when function returns. Please DO NOT use panic in the cb function.

func (*WaitGroup) RunWithRecover

func (w *WaitGroup) RunWithRecover(exec func(), recoverFn func(r interface{}))

RunWithRecover wraps goroutine startup call with force recovery, add 1 to WaitGroup and call done when function return. it will dump current goroutine stack into log if catch any recover result. exec is that execute logic function. recoverFn is that handler will be called after recover and before dump stack, passing `nil` means noop.

Jump to

Keyboard shortcuts

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