mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-01 14:43:07 +02:00
refactor(concurrency): replaced manual WaitGroup management with new wg.Go() and removed redundant code.
This commit is contained in:
@@ -12,14 +12,12 @@ func TestRefCounterAddSub(t *testing.T) {
|
||||
rc := NewRefCounter() // Count starts at 1
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(2)
|
||||
|
||||
rc.Add()
|
||||
for range 2 {
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
wg.Go(func() {
|
||||
rc.Sub()
|
||||
}()
|
||||
})
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
|
||||
Reference in New Issue
Block a user