cmd/geth, miner, backend, xeth: Fixed miner threads to be settable

Miner threads are now settable through the admin interface (closes #897)
and specify 0 CPU worker threads when eth_getWork is called (closes #916)
This commit is contained in:
obscuren
2015-05-11 15:43:14 +02:00
parent 064cf16099
commit 21e52efdfe
9 changed files with 46 additions and 43 deletions

View File

@ -141,7 +141,6 @@ func (self *worker) start() {
for _, agent := range self.agents {
agent.Start()
}
}
func (self *worker) stop() {
@ -149,10 +148,16 @@ func (self *worker) stop() {
defer self.mu.Unlock()
if atomic.LoadInt32(&self.mining) == 1 {
var keep []Agent
// stop all agents
for _, agent := range self.agents {
agent.Stop()
// keep all that's not a cpu agent
if _, ok := agent.(*CpuAgent); !ok {
keep = append(keep, agent)
}
}
self.agents = keep
}
atomic.StoreInt32(&self.mining, 0)