code: func (b *blockManager) Stop() error {
  	if atomic.AddInt32(&b.shutdown, 1) != 1 {
  		log.Warnf("Block manager is already in the process of " +
  			"shutting down")
  		return nil
  	}
  
  	// We'll send out update signals before the quit to ensure that any
  	// goroutines waiting on them will properly exit.
  	done := make(chan struct{})
  	go func() {
  		ticker := time.NewTicker(time.Millisecond * 50)
  		defer ticker.Stop()
  
  		for {
  			select {
  			case <-done:
  				return
  			case <-ticker.C:
  			}
  
  			b.newHeadersSignal.Broadcast()
  			b.newFilterHeadersSignal.Broadcast()
  		}
  	}()
  
  	log.Infof("Block manager shutting down")
  	close(b.quit)
  	b.wg.Wait()
  
  	close(done)
  	return nil
  }
docs: // Stop gracefully shuts down the block manager by stopping all asynchronous
  // handlers and waiting for them to finish.