Documentation ¶
Index ¶
- type IJob
- type IRunJob
- type IStopJob
- type Job
- type JobFunc
- type Task
- func (t *Task) Add(job *Job) (jobId string)
- func (t *Task) Delete(id string)
- func (t *Task) Get(jobId string) *Job
- func (t *Task) Run(jobId string) error
- func (t *Task) RunWithDeadline(jobId string, d time.Time) error
- func (t *Task) RunWithTimeout(jobId string, duration time.Duration) error
- func (t *Task) Stop(jobId string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Job ¶
type Job struct {
// contains filtered or unexported fields
}
Job 作业任务
func NewJob ¶
NewJob 新建一个作业 列如:
var JobFunc1 JobFunc = func() errs { fmt.Println("第一个任务,我运行了") return nil }
job1 := NewJob(jobFun1)
func (*Job) RunWithDeadline ¶
RunWithDeadline 执行作业任务,超过某个时间点自动停止.
func (*Job) RunWithTimeout ¶
RunWithTimeout 执行作业任务,超时自动停止.可调用 Stop 手动关闭.
type Task ¶
type Task struct {
// contains filtered or unexported fields
}
Task 任务池
func (*Task) RunWithDeadline ¶
RunWithDeadline 执行作业任务,超过某个时间点自动停止
func (*Task) RunWithTimeout ¶
RunWithTimeout 执行作业任务,超时自动停止
Click to show internal directories.
Click to hide internal directories.