waitgroup

package
v0.0.0-...-d63e69c Latest Latest
Warning

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

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

Documentation

Overview

Package waitgroup implements SafeWaitGroup wrap of sync.WaitGroup. Add with positive delta when waiting will fail, to prevent sync.WaitGroup race issue.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SafeWaitGroup

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

SafeWaitGroup must not be copied after first use.

func (*SafeWaitGroup) Add

func (wg *SafeWaitGroup) Add(delta int) error

Add adds delta, which may be negative, similar to sync.WaitGroup. If Add with a positive delta happens after Wait, it will return error, which prevent unsafe Add.

func (*SafeWaitGroup) Done

func (wg *SafeWaitGroup) Done()

Done decrements the WaitGroup counter.

func (*SafeWaitGroup) Wait

func (wg *SafeWaitGroup) Wait()

Wait blocks until the WaitGroup counter is zero.

Jump to

Keyboard shortcuts

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