Documentation ¶
Overview ¶
Package simplewg provides a convenience wrapper for sync.WaitGroup. It automates the invocation of sync.WaitGroup.Add and sync.WaitGroup.Done.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Wg ¶
type Wg struct {
// contains filtered or unexported fields
}
Wg struct wraps sync.WaitGroup to offer enhanced concurrency control. It manages the lifecycle of goroutines and ensures synchronization between them.
func (*Wg) Done ¶ added in v0.1.0
func (wg *Wg) Done() <-chan struct{}
Done returns a channel that gets closed when all goroutines have finished. The first call to Done prevents new goroutines from starting via Go.
func (*Wg) Go ¶
Go method initiates a function in a separate goroutine. Once Wg.Wait has been called for the first time, subsequent calls to Go will not execute the function. Returns true if the function is executed, false otherwise. Note: Handling of any panics is the responsibility of the caller. This method does not propagate panics created in the underlying goroutine.