Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( PoolStopedError = errors.New("task pool stoped") PoolFullError = errors.New("task pool full") )
Functions ¶
func SetGExcutor ¶
func SetGExcutor(excutor Excutor)
Types ¶
type Excutor ¶
type Excutor interface { //执行方法 Excute(task *TaskService) error //执行器关闭方法 Close() }
任务执行器
type MultiplePoolExcutor ¶
type MultiplePoolExcutor struct {
// contains filtered or unexported fields
}
并发执行器
func (*MultiplePoolExcutor) Excute ¶
func (p *MultiplePoolExcutor) Excute(task *TaskService) error
Excutor.Excute()
type TaskExcutor ¶
type TaskExcutor chan *TaskService
func NewTaskExcutor ¶
func NewTaskExcutor(chanSize int) TaskExcutor
func (TaskExcutor) Close ¶
func (c TaskExcutor) Close()
func (TaskExcutor) Excute ¶
func (c TaskExcutor) Excute(task *TaskService) (err error)
type TaskService ¶
type TaskService struct { Cancel bool //是否取消回调 ID interface{} // contains filtered or unexported fields }
func NewTaskService ¶
func NewTaskService(callback CallBack, params ...interface{}) *TaskService
func (*TaskService) AddArgs ¶
func (t *TaskService) AddArgs(startIndex int, args ...interface{}) *TaskService
添加回调函数参数,startIndex<0表示顺序添加,startIndex>=0表示将参数从指定位置开始添加,原来位置的参数依次后移
Click to show internal directories.
Click to hide internal directories.