mirror of
https://github.com/panjf2000/ants.git
synced 2025-12-16 18:11:03 +00:00
rename some symbol
This commit is contained in:
parent
4927155de3
commit
020959a1d5
17
ants.go
17
ants.go
@ -28,39 +28,40 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// DefaultPoolSize is the default capacity for a default goroutine pool
|
// DefaultAntsPoolSize is the default capacity for a default goroutine pool
|
||||||
DefaultPoolSize = math.MaxInt32
|
DefaultAntsPoolSize = math.MaxInt32
|
||||||
|
|
||||||
// DefaultCleanIntervalTime is the interval time to clean up goroutines
|
// DefaultCleanIntervalTime is the interval time to clean up goroutines
|
||||||
DefaultCleanIntervalTime = 10
|
DefaultCleanIntervalTime = 10
|
||||||
)
|
)
|
||||||
|
|
||||||
// Init a instance pool when importing ants
|
// Init a instance pool when importing ants
|
||||||
var defaultPool, _ = NewPool(DefaultPoolSize)
|
var defaultAntsPool, _ = NewPool(DefaultAntsPoolSize)
|
||||||
|
|
||||||
// Submit submit a task to pool
|
// Submit submit a task to pool
|
||||||
func Submit(task f) error {
|
func Submit(task f) error {
|
||||||
return defaultPool.Submit(task)
|
return defaultAntsPool.Submit(task)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Running returns the number of the currently running goroutines
|
// Running returns the number of the currently running goroutines
|
||||||
func Running() int {
|
func Running() int {
|
||||||
return defaultPool.Running()
|
return defaultAntsPool.Running()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cap returns the capacity of this default pool
|
// Cap returns the capacity of this default pool
|
||||||
func Cap() int {
|
func Cap() int {
|
||||||
return defaultPool.Cap()
|
return defaultAntsPool.Cap()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free returns the available goroutines to work
|
// Free returns the available goroutines to work
|
||||||
func Free() int {
|
func Free() int {
|
||||||
return defaultPool.Free()
|
return defaultAntsPool.Free()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release Closed the default pool
|
// Release Closed the default pool
|
||||||
func Release() {
|
func Release() {
|
||||||
defaultPool.Release()
|
defaultAntsPool.Release()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Errors for the Ants API
|
// Errors for the Ants API
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user