老师,下面是您的代码(省略无关代码):
type Scheduler interface {
ReadyNotifier
Submit(Request)
WorkerChan() chan Request
Run()
}
type ReadyNotifier interface {
WorkerReady(chan Request)
}
func (e *ConcurrentEngine) Run(seeds ...Request) {
for i := 0; i < e.WorkerCount; i++{
createWorker(e.Scheduler.WorkerChan(), out, e.Scheduler)
}
}
func createWorker(in chan Request, out chan ParseResult, ready ReadyNotifier) {
。。。。
}
createWorker(e.Scheduler.WorkerChan(), out, e.Scheduler) 传入的参数是 e.Scheduler 为什么接受者居然是ReadyNotifier
这儿不太明白,能解释下吗?