Documentation ¶
Overview ¶
2017-10-24 16:20 Package gxruntime encapsulates some runtime functions goroutine pool ref: https://github.com/pingcap/tidb/blob/1592c7bc2873346565ab15ecfbc22749a775e014/util/goroutine_pool/gp.go
Index ¶
Constants ¶
const ( PoolInit = iota PoolStarting PoolGcing PoolClosing PoolClosed )
const (
OnceLoopGoroutineNum = 30
)
Variables ¶
var (
ErrGoroutinePoolClosed = fmt.Errorf("GoroutinePool has been closed.")
)
Functions ¶
Types ¶
type Pool ¶ added in v0.2.0
Pool is a struct to represent goroutine pool.
func NewGoroutinePool ¶ added in v0.2.0
New returns a new *Pool object. DEPRECATED: https://github.com/pingcap/tidb/pull/7564 After Go1.11, goroutine pool is harmful.
The test result is as follows: go test -test.bench Benchmark goos: darwin goarch: amd64 pkg: github.com/AlexStocks/goext/runtime BenchmarkGoPool-4 3000000 619 ns/op BenchmarkGo-4 5000000 319 ns/op BenchmarkMorestackPool-4 3000000 534 ns/op BenchmarkMoreStack-4 2000000 667 ns/op