Documentation ¶
Index ¶
- Variables
- type Task
- type TaskExecutor
- func (e *TaskExecutor) Async(task Task) error
- func (e *TaskExecutor) RunFunc() lifecycle.InterruptedRunFunc
- func (e *TaskExecutor) StartFunc() lifecycle.InterruptedStartFunc
- func (e *TaskExecutor) Sync(task Task) error
- func (e *TaskExecutor) Try(task Task) (ok bool, err error)
- func (e *TaskExecutor) Wait() error
Constants ¶
This section is empty.
Variables ¶
View Source
var TaskExecutorClosedError = errors.New("任务执行器已关闭")
Functions ¶
This section is empty.
Types ¶
type Task ¶
type Task interface {
Do(interrupter chan struct{}) (interrupted bool)
}
func Interrupted ¶
type TaskExecutor ¶
func NewTaskExecutor ¶
func NewTaskExecutor(maxTask int) *TaskExecutor
func (*TaskExecutor) Async ¶
func (e *TaskExecutor) Async(task Task) error
func (*TaskExecutor) RunFunc ¶
func (e *TaskExecutor) RunFunc() lifecycle.InterruptedRunFunc
func (*TaskExecutor) StartFunc ¶
func (e *TaskExecutor) StartFunc() lifecycle.InterruptedStartFunc
func (*TaskExecutor) Sync ¶
func (e *TaskExecutor) Sync(task Task) error
func (*TaskExecutor) Wait ¶
func (e *TaskExecutor) Wait() error
Click to show internal directories.
Click to hide internal directories.