go-ethereum icon indicating copy to clipboard operation
go-ethereum copied to clipboard

beacon,console,core,eth,p2p,rpc: keep `wg.Add` and `wg.Done` closer

Open Halimao opened this issue 9 months ago • 0 comments

Similar to #29813, this PR modifies all other sync.WaitGroup cases.

  1. call wg.Done without wg.Add will cause panic.
  2. wg.Done() is meaningless without wg.Add and goroutine
  3. Putting wg.Add and wg.Done together can makes us easily ensure that both counts are equal.

Halimao avatar May 22 '24 08:05 Halimao