Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct {
TaskChannel chan Job // Store all job
DispatchControl chan bool // Control add job go routine
WorkerPool chan chan Job // Store worker private job channel
WorkerList []*Worker // Store worker instance
MaxWorker int // Max worker number
IsClosed bool // Dispatcher is closed ?
}
Dispatcher is used to dispatch job
func NewDispatcher ¶
func NewDispatcher(maxWorker int) *Dispatcher
NewDispatcher is used to create dispatch
func (*Dispatcher) AddJob ¶
func (d *Dispatcher) AddJob(job Job) bool
AddJob is used job to global job channel
Click to show internal directories.
Click to hide internal directories.