threading

package
v0.0.0-...-3ead46a Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoLimit

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

func NewGoLimit

func NewGoLimit(max uint) *GoLimit

func (*GoLimit) Add

func (g *GoLimit) Add()

func (*GoLimit) Count

func (g *GoLimit) Count() uint

Count 获取并发计数

func (*GoLimit) Done

func (g *GoLimit) Done()

Done then count - 1 若计数<max_num, 可以使原阻塞的Add()快速解除阻塞

func (*GoLimit) Max

func (g *GoLimit) Max() uint

Max 获取最大并发计数

func (*GoLimit) SetMax

func (g *GoLimit) SetMax(n uint)

SetMax 更新最大并发计数为, 若是调大, 可以使原阻塞的Add()快速解除阻塞

func (*GoLimit) WaitZero

func (g *GoLimit) WaitZero()

WaitZero 若当前并发计数为0, 则快速返回; 否则阻塞等待,直到并发计数为0

Jump to

Keyboard shortcuts

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