countdownlatchx

package
v0.0.0-...-d3b5644 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

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

Group 实现了一个计数器,当计数器归零时,等待的函数将被释放。 它是线程安全的,可以在多个goroutine中使用。

func NewGroup

func NewGroup(delta int) *Group

NewGroup 创建一个新的CountDownLatch实例,初始化计数器为delta。

func (*Group) CountDown

func (cdl *Group) CountDown()

CountDown 将计数器减一。当计数器归零时,等待的函数将被释放。

func (*Group) Wait

func (cdl *Group) Wait()

Wait 等待计数器归零。

func (*Group) WaitContext

func (cdl *Group) WaitContext(ctx context.Context) error

WaitContext 等待计数器归零,同时监听context的取消事件。 如果context被取消,将返回context的错误。

Jump to

Keyboard shortcuts

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