Categorygithub.com/codeclysm/cc
modulepackage
1.2.2
Repository: https://github.com/codeclysm/cc.git
Documentation: pkg.go.dev

# README

cc

A golang waitgroup with limits and error reporting

Usage:

import github.com/codeclysm/cc

p := cc.New(4)
p.Run(func() error {
	return errors.New("fail1")
})
p.Run(func() error {
	return errors.New("fail2")
})
p.Run(func() error {
	return nil
})

errs := p.Wait() // returns a list of errors [fail1, fail2]

# Functions

New returns a new pool where a limited number (concurrency) of goroutine can work at the same time.
Run creates a new stoppable function from the provided funcs.

# Structs

Pool manages a pool of concurrent workers.
Stoppable is a function that can be stopped with the method Stop.

# Type aliases

StoppableFunc is a func that receives a stop channel that when closed broadcasts the need to wrap up and stop the function.