Skip to content

Instantly share code, notes, and snippets.

@prembhaskal
Created March 14, 2022 17:17
Show Gist options
  • Save prembhaskal/afc28b4ecc71706ab54b5301e1cbf7ad to your computer and use it in GitHub Desktop.
Save prembhaskal/afc28b4ecc71706ab54b5301e1cbf7ad to your computer and use it in GitHub Desktop.
package parallel_test
import (
"sync"
"testing"
"github.com/prembhaskal/go_practice/learning/parallel"
)
func TestRaceTest2(t *testing.T) {
l := parallel.NewLibrarySync()
var wg sync.WaitGroup
for i := 0; i < 1000; i++ {
j := i
wg.Add(1)
go func() {
c := l.C()
c.Add(j)
wg.Done()
}()
wg.Add(1)
go func(){
l.UpdateClient()
wg.Done()
}()
}
wg.Wait()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment