Created
March 10, 2022 16:24
-
-
Save prembhaskal/90c90578373545418eea2c4fae992c11 to your computer and use it in GitHub Desktop.
test code to check the synchronous access.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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