code: func (m *CPUMiner) SetNumWorkers(numWorkers int32) {
  	if numWorkers == 0 {
  		m.Stop()
  	}
  
  	// Don't lock until after the first check since Stop does its own
  	// locking.
  	m.Lock()
  	defer m.Unlock()
  
  	// Use default if provided value is negative.
  	if numWorkers < 0 {
  		m.numWorkers = defaultNumWorkers
  	} else {
  		m.numWorkers = uint32(numWorkers)
  	}
  
  	// When the miner is already running, notify the controller about the
  	// the change.
  	if m.started {
  		m.updateNumWorkers <- struct{}{}
  	}
  }
docs: // SetNumWorkers sets the number of workers to create which solve blocks.  Any
  // negative values will cause a default number of workers to be used which is
  // based on the number of processor cores in the system.  A value of 0 will
  // cause all CPU mining to be stopped.
  //
  // This function is safe for concurrent access.