timeoutwg

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

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

Go to latest
Published: Mar 22, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TimeoutWaitGroup

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

TimeoutWaitGroup works just like a normal wait-group, but Wait will exit and return true if all tasks have not declared Done() before the timeout expires. It's most useful in tests, but can also be useful for waiters which want to periodically report progress (number of remaining workers).

func (*TimeoutWaitGroup) Add

func (twg *TimeoutWaitGroup) Add(delta int)

Add increments the wait group's count of active workers by delta.

func (*TimeoutWaitGroup) Done

func (twg *TimeoutWaitGroup) Done()

Done decrements the wait group count by one.

func (*TimeoutWaitGroup) Wait

func (twg *TimeoutWaitGroup) Wait(waitDuration time.Duration) int

Wait blocks until waitDuration has passed or all workers have called Done(), which ever comes first. Wait returns the number of

Jump to

Keyboard shortcuts

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