Documentation
¶
Overview ¶
Package syncx contains useful synchronization primitives.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lazy ¶ added in v0.4.3
type Lazy[T any] struct { // contains filtered or unexported fields }
Lazy represents a lazily computed value.
type LimitedWaitGroup ¶
type LimitedWaitGroup struct {
// contains filtered or unexported fields
}
LimitedWaitGroup is a version of sync.WaitGroup that limits the number of concurrently working goroutines by using a buffered channel as a semaphore.
func NewLimitedWaitGroup ¶
func NewLimitedWaitGroup(limit int) *LimitedWaitGroup
NewLimitedWaitGroup returns a new LimitedWaitGroup that limits the number of concurrently working goroutines to limit.
func (*LimitedWaitGroup) Add ¶
func (lwg *LimitedWaitGroup) Add(delta int)
Add increments the counter of the LimitedWaitGroup by the specified delta. It blocks if the number of active goroutines reaches the concurrency limit.
func (*LimitedWaitGroup) Done ¶
func (lwg *LimitedWaitGroup) Done()
Done decrements the counter of the LimitedWaitGroup by one and releases a slot in the semaphore, allowing another goroutine to start.
func (*LimitedWaitGroup) Wait ¶
func (lwg *LimitedWaitGroup) Wait()
Wait blocks until the counter of the LimitedWaitGroup becomes zero.
type Protected ¶ added in v0.5.0
type Protected[T any] struct { // contains filtered or unexported fields }
Protected provides synchronized access to a value of type T.