mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-01 06:33:18 +02:00
refactor(concurrency): simplify some waitgroup usage, remove extra wg.Done in wg.Go left in 11af9d1 in io.go
This commit is contained in:
@@ -95,11 +95,9 @@ func (p BidirectionalPipe) Start() error {
|
||||
var srcErr, dstErr error
|
||||
wg.Go(func() {
|
||||
srcErr = p.pSrcDst.Start()
|
||||
wg.Done()
|
||||
})
|
||||
wg.Go(func() {
|
||||
dstErr = p.pDstSrc.Start()
|
||||
wg.Done()
|
||||
})
|
||||
wg.Wait()
|
||||
return errors.Join(srcErr, dstErr)
|
||||
|
||||
@@ -15,9 +15,7 @@ func TestRefCounterAddSub(t *testing.T) {
|
||||
|
||||
rc.Add()
|
||||
for range 2 {
|
||||
wg.Go(func() {
|
||||
rc.Sub()
|
||||
})
|
||||
wg.Go(rc.Sub)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
|
||||
Reference in New Issue
Block a user