Documentation
¶
Index ¶
- Constants
- Variables
- func Add(f func()) error
- func AddWithRecover(userFunc func(), recoverFunc ...func(err error)) error
- func AddWithSyncFunc(useFunc func(), syncFunc func(bool)) error
- func FILOAnywayGo(fn func())
- func FILOGo(fn func()) bool
- func FILOMustGo(fn func(), ctx ...context.Context) error
- func FILOTryGo(fn func())
- func Go(fn func()) bool
- func Jobs() int
- func SetFILOPool(maxGoroutinesAmount int, maxGoroutineIdleDuration time.Duration)
- func Size() int
- type FILOPool
- type Pool
- func (that *Pool) Add(f func()) error
- func (that *Pool) AddWithRecover(useFunc func(), recoverFunc ...func(err error)) error
- func (that *Pool) AddWithSyncFunc(useFunc func(), syncFunc func(bool)) error
- func (that *Pool) Cap() int
- func (that *Pool) Close()
- func (that *Pool) IsClosed() bool
- func (that *Pool) Jobs() int
- func (that *Pool) Size() int
Constants ¶
View Source
const ( // DefaultMaxGoroutinesAmount 默认的协程最大数量 DefaultMaxGoroutinesAmount = 256 * 1024 // DefaultMaxGoroutineIdleDuration 默认协程最大空闲时间 DefaultMaxGoroutineIdleDuration = 10 * time.Second )
Variables ¶
View Source
var ErrLack = errors.New("lack of goroutines, because exceeded maxGoroutinesAmount limit")
Functions ¶
func AddWithRecover ¶
AddWithRecover 在默认协程池中执行方法,并且执行完成后,如果出错,则调用recover方法
func AddWithSyncFunc ¶
AddWithSyncFunc 在默认协程池中执行方法,执行完成后回调
func FILOMustGo ¶ added in v0.1.2
FILOMustGo 强制执行方法,并且传入上下文
func SetFILOPool ¶ added in v0.1.2
Types ¶
type FILOPool ¶ added in v0.1.2
type FILOPool struct {
// contains filtered or unexported fields
}
func NewFILOPool ¶ added in v0.1.2
NewFILOPool 创建协程栈池
func (*FILOPool) MaxGoroutineIdle ¶ added in v0.1.2
func (*FILOPool) MaxGoroutinesAmount ¶ added in v0.1.2
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool Goroutine Pool
func (*Pool) AddWithRecover ¶
AddWithRecover 添加任务,并在任务执行出错的情况下,回调recoverFunc
func (*Pool) AddWithSyncFunc ¶
AddWithSyncFunc 执行成功后回调方法
Click to show internal directories.
Click to hide internal directories.