MCPcopy Index your code
hub / github.com/sourcegraph/conc / WithMaxGoroutines

Method WithMaxGoroutines

pool/pool.go:89–96  ·  view source on GitHub ↗

WithMaxGoroutines limits the number of goroutines in a pool. Defaults to unlimited. Panics if n < 1.

(n int)

Source from the content-addressed store, hash-verified

87// WithMaxGoroutines limits the number of goroutines in a pool.
88// Defaults to unlimited. Panics if n < 1.
89func (p *Pool) WithMaxGoroutines(n int) *Pool {
90 p.panicIfInitialized()
91 if n < 1 {
92 panic("max goroutines in a pool must be greater than zero")
93 }
94 p.limiter = make(limiter, n)
95 return p
96}
97
98// init ensures that the pool is initialized before use. This makes the
99// zero value of the pool usable.

Callers 8

TestResultGroupFunction · 0.45
TestContextPoolFunction · 0.45
TestErrorPoolFunction · 0.45
TestResultErrorGroupFunction · 0.45
TestResultContextPoolFunction · 0.45
ExamplePoolFunction · 0.45
TestPoolFunction · 0.45

Calls 1

panicIfInitializedMethod · 0.95

Tested by 8

TestResultGroupFunction · 0.36
TestContextPoolFunction · 0.36
TestErrorPoolFunction · 0.36
TestResultErrorGroupFunction · 0.36
TestResultContextPoolFunction · 0.36
ExamplePoolFunction · 0.36
TestPoolFunction · 0.36