limitgroup

package module
v0.0.0-...-6abd8d7 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2015 License: BSD-3-Clause Imports: 1 Imported by: 4

README

Documentation

Overview

Package limitgroup provides a sync.WaitGroup equivalent with a configurable upper bound. This is implemented by having Add() block as well if necessary.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LimitGroup

type LimitGroup struct {
	sync.WaitGroup
	// contains filtered or unexported fields
}

LimitGroup provides a WaitGroup with a limited upper bound. Once the limit is hit, Add will block until sufficient deltas are returned.

func NewLimitGroup

func NewLimitGroup(limit uint) *LimitGroup

NewLimitGroup creates a new LimitGroup with the configured limit.

func (*LimitGroup) Add

func (l *LimitGroup) Add(delta int)

Add adds delta, which may be negative. It will block if we have hit the limit, and will unblock as Done is called.

func (*LimitGroup) Done

func (l *LimitGroup) Done()

Done decrements the counter.

Jump to

Keyboard shortcuts

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