csync

package
v0.4.0-nightly.20221124 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: Apache-2.0 Imports: 4 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 sync.WaitGroup

WaitGroup is a sync.WaitGroup with utility methods.

func (*WaitGroup) Add

func (wg *WaitGroup) Add(delta int)

Add adds delta, which may be negative, to the WaitGroup counter. If the counter becomes zero, all goroutines blocked on Wait are released. If the counter goes negative, Add panics.

Note that calls with a positive delta that occur when the counter is zero must happen before a Wait. Calls with a negative delta, or calls with a positive delta that start when the counter is greater than zero, may happen at any time. Typically this means the calls to Add should execute before the statement creating the goroutine or other event to be waited for. If a WaitGroup is reused to wait for several independent sets of events, new Add calls must happen after all previous Wait calls have returned. See the WaitGroup example.

func (*WaitGroup) Done

func (wg *WaitGroup) Done()

Done decrements the WaitGroup counter by one.

func (*WaitGroup) Wait

func (wg *WaitGroup) Wait(ctx context.Context) error

Wait blocks until the WaitGroup counter is zero. If the context gets canceled before that happens the method returns an error.

func (*WaitGroup) WaitTimeout

func (wg *WaitGroup) WaitTimeout(ctx context.Context, timeout time.Duration) error

WaitTimeout blocks until the WaitGroup counter is zero. If the context gets canceled or the timeout is reached before that happens the method returns an error.

Jump to

Keyboard shortcuts

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