Documentation ¶
Index ¶
- func Parallel(count, workers int, fn func(i int))
- func ParallelChunks(count, chunkSize, workers int, fn func(start, end int))
- func ParallelRanges(count, workers int, fn func(start, end int))
- func ThrottleHead(duration time.Duration, fn func()) func()
- func ThrottleTail(duration time.Duration, fn func()) func()
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Parallel ¶
Parallel spawns `workers` goroutines and invokes the function in each routine from `start` to `end`. It blocks until all functions return.
func ParallelChunks ¶
ParallelChunks divides the domain into chunks of "chunkSize" and feeds it to the function, with bounded concurrency of `worker` functions.
func ParallelRanges ¶
ParallelRanges divides up the the domain into segments and dispatches them to worker functions.
func ThrottleHead ¶
ThrottleTail returns a function that calls fn() at most every duration, when the first call is on the head of the duration.
func ThrottleTail ¶
ThrottleTail returns a function that calls fn() at most every duration, when the first call is on the tail of the duration.
Types ¶
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value is an implementation of atomic.Value which does not require consistent concrete types to be stored. It must not be copied after initialization.