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.
Click to show internal directories.
Click to hide internal directories.