Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GenericTaskPool ¶ added in v1.9.6
type GenericTaskPool interface {
// AddTask wait idle worker add task
AddTask(t task) bool
// AddTaskAlways add task to queues or do it immediately
AddTaskAlways(t task)
// AddTaskBalance add task to idle queue
AddTaskBalance(t task)
// Close use to close the task pool
Close()
// IsClosed use to check pool status.
IsClosed() bool
}
GenericTaskPool represents an generic task pool.
func NewTaskPool ¶
func NewTaskPool(opts ...TaskPoolOption) GenericTaskPool
NewTaskPool build a task pool
func NewTaskPoolSimple ¶ added in v1.9.6
func NewTaskPoolSimple(size int) GenericTaskPool
NewTaskPoolSimple build a simple task pool
type TaskPool ¶
type TaskPool struct {
TaskPoolOptions
// contains filtered or unexported fields
}
/////////////////////////////////////// Task Pool /////////////////////////////////////// task pool: manage task ts
func (*TaskPool) AddTaskAlways ¶ added in v1.7.0
func (p *TaskPool) AddTaskAlways(t task)
func (*TaskPool) AddTaskBalance ¶ added in v1.7.0
func (p *TaskPool) AddTaskBalance(t task)
do it immediately when no idle queue
type TaskPoolOption ¶
type TaskPoolOption func(*TaskPoolOptions)
func WithTaskPoolTaskPoolSize ¶
func WithTaskPoolTaskPoolSize(size int) TaskPoolOption
WithTaskPoolTaskPoolSize set @size of the task queue pool size
func WithTaskPoolTaskQueueLength ¶
func WithTaskPoolTaskQueueLength(length int) TaskPoolOption
WithTaskPoolTaskQueueLength set @length of the task queue length
func WithTaskPoolTaskQueueNumber ¶
func WithTaskPoolTaskQueueNumber(number int) TaskPoolOption
WithTaskPoolTaskQueueNumber set @number of the task queue number
type TaskPoolOptions ¶
type TaskPoolOptions struct {
// contains filtered or unexported fields
}
TaskPoolOptions is optional settings for task pool
Click to show internal directories.
Click to hide internal directories.