Skip to content

Instantly share code, notes, and snippets.

@prembhaskal
Created March 10, 2022 16:24
Show Gist options
  • Save prembhaskal/90c90578373545418eea2c4fae992c11 to your computer and use it in GitHub Desktop.
Save prembhaskal/90c90578373545418eea2c4fae992c11 to your computer and use it in GitHub Desktop.
test code to check the synchronous access.
package parallel_test
import (
"sync"
"testing"
)
func TestRaceTest1(t *testing.T) {
l := parallel.NewLibrary()
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