sync2

package
v0.1.37 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT, MIT Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

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

Limiter implements concurrent goroutine limiting.

After calling Wait or Close, no new goroutines are allowed to start.

func NewLimiter

func NewLimiter(n int) *Limiter

NewLimiter creates a new limiter with limit set to n.

func (*Limiter) Close

func (limiter *Limiter) Close()

Close waits for all running goroutines to finish and disallows new goroutines to start.

func (*Limiter) Go

func (limiter *Limiter) Go(ctx context.Context, fn func()) bool

Go tries to start fn as a goroutine. When the limit is reached it will wait until it can run it or the context is canceled.

func (*Limiter) Wait

func (limiter *Limiter) Wait()

Wait waits for all running goroutines to finish and disallows new goroutines to start.

Jump to

Keyboard shortcuts

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