Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type 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.
func (*WaitGroup) RunWithLogger ¶
func (*WaitGroup) RunWithRecover ¶
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.
type WaitGroupPool ¶
WaitGroupPool is a wrapper for sync.WaitGroup and gp.Pool.
func NewWaitGroupPool ¶
func NewWaitGroupPool(n int, idleDuration time.Duration) *WaitGroupPool
NewWaitGroupPool returns WaitGroupPool.
func (*WaitGroupPool) Close ¶
func (w *WaitGroupPool) Close()
func (*WaitGroupPool) RunWithRecover ¶
func (w *WaitGroupPool) RunWithRecover(exec func(), recoverFn func(r interface{}), logger *zap.Logger)
RunWithRecover runs a function in a goroutine, adds 1 to WaitGroup and calls done when function returns.