Пример #1
0
func (self *worker) push(work *Work) {
	if atomic.LoadInt32(&self.mining) == 1 {
		if core.Canary(work.state) {
			glog.Infoln("Toxicity levels rising to deadly levels. Your canary has died. You can go back or continue down the mineshaft --more--")
			glog.Infoln("You turn back and abort mining")
			return
		}
		// push new work to agents
		for agent := range self.agents {
			atomic.AddInt32(&self.atWork, 1)
			if agent.Work() != nil {
				agent.Work() <- work
			}
		}
	}
}
Пример #2
0
func (self *worker) push() {
	if atomic.LoadInt32(&self.mining) == 1 {
		if core.Canary(self.current.state) {
			glog.Infoln("Toxicity levels rising to deadly levels. Your canary has died. You can go back or continue down the mineshaft --more--")
			glog.Infoln("You turn back and abort mining")
			return
		}

		// push new work to agents
		for _, agent := range self.agents {
			atomic.AddInt32(&self.atWork, 1)

			if agent.Work() != nil {
				agent.Work() <- self.current.block
			} else {
				common.Report(fmt.Sprintf("%v %T\n", agent, agent))
			}
		}
	}
}