Created
March 14, 2022 17:17
-
-
Save prembhaskal/afc28b4ecc71706ab54b5301e1cbf7ad to your computer and use it in GitHub Desktop.
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" | |
"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