Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrBacklogIsNotEnough indicates the backlog is not enough ErrBacklogIsNotEnough = errors.New("concurrency backlog is not enough") // ErrAlreadyQuit indicates the job group is quit ErrAlreadyQuit = errors.New("jobGroup is ready quit") )
Functions ¶
This section is empty.
Types ¶
type JobGroup ¶
type JobGroup struct {
// contains filtered or unexported fields
}
JobGroup job group
func NewJobGroup ¶
NewJobGroup returns a JobGroup
func (*JobGroup) Abort ¶
func (jg *JobGroup) Abort()
Abort the job group and returns at once, however the workers would still do its jobs
func (*JobGroup) AbortWait ¶
func (jg *JobGroup) AbortWait()
AbortWait the job group and wait until the workers is done
func (*JobGroup) GoWithPayload ¶
GoWithPayload commits a raw payload
func (*JobGroup) GoWithWeight ¶
GoWithWeight commits a job to the backlog with weight
type Payload ¶
type Payload struct {
// contains filtered or unexported fields
}
Payload the job exactly be run
func NewPayload ¶
func NewPayload(f func()) *Payload
NewPayload returns a payload with the job function
func (*Payload) SetTimeout ¶
SetTimeout set the payload timeout and che cancel function,
caution: set a job with timeout DOES NOT make sure the job to cancel, the cancel function just be called after timeout
Click to show internal directories.
Click to hide internal directories.