waitgroup

package
v3.5.3+incompatible Latest Latest
Warning

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

Go to latest
Published: May 29, 2018 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package waitgroup sync.WaitGroup extension

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WaitGroup

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

WaitGroup 在 sync.WaitGroup 的基础上, 新增线程控制功能

func NewWaitGroup

func NewWaitGroup(parallel int) (w *WaitGroup)

NewWaitGroup returns a pointer to a new `WaitGroup` object. parallel 为最大并发数, 0 代表无限制

func (*WaitGroup) AddDelta

func (w *WaitGroup) AddDelta()

AddDelta sync.WaitGroup.Add(1)

func (*WaitGroup) Done

func (w *WaitGroup) Done()

Done sync.WaitGroup.Done()

func (*WaitGroup) Parallel

func (w *WaitGroup) Parallel() int

Parallel 返回当前正在进行的任务数量

func (*WaitGroup) Wait

func (w *WaitGroup) Wait()

Wait 参照 sync.WaitGroup 的 Wait 方法

Jump to

Keyboard shortcuts

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