semaphoregroup

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SemaphoreGroup

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

SemaphoreGroup is a custom type that combines sync.WaitGroup and a semaphore.

func NewSemaphoreGroup

func NewSemaphoreGroup(limit int) *SemaphoreGroup

NewSemaphoreGroup creates a new SemaphoreGroup with the specified semaphore limit.

func (*SemaphoreGroup) Add

func (sg *SemaphoreGroup) Add(ctx context.Context)

Add increments the internal WaitGroup counter and acquires a semaphore slot.

func (*SemaphoreGroup) Done

func (sg *SemaphoreGroup) Done(ctx context.Context)

Done decrements the internal WaitGroup counter and releases a semaphore slot.

func (*SemaphoreGroup) Wait

func (sg *SemaphoreGroup) Wait()

Wait waits until the internal WaitGroup counter is zero.

Jump to

Keyboard shortcuts

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