apimachineryk8s.io/apimachinery/pkg/util/waitgroup Index | Files

package waitgroup

import "k8s.io/apimachinery/pkg/util/waitgroup"

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

Index

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.

Source Files

doc.go waitgroup.go

Version
v0.22.11-rc.0
Published
Jan 15, 2022
Platform
js/wasm
Imports
2 packages
Last checked
3 hours ago

Tools for package owners.