- Sort Score
- Result 10 results
- Languages All
Results 1 - 1 of 1 for TestOnce (0.09 sec)
-
src/sync/once_test.go
*o++ } func run(t *testing.T, once *Once, o *one, c chan bool) { once.Do(func() { o.Increment() }) if v := *o; v != 1 { t.Errorf("once failed inside run: %d is not 1", v) } c <- true } func TestOnce(t *testing.T) { o := new(one) once := new(Once) c := make(chan bool) const N = 10 for i := 0; i < N; i++ { go run(t, once, o, c) } for i := 0; i < N; i++ { <-c } if *o != 1 {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Sep 16 21:22:33 UTC 2014 - 1.1K bytes - Viewed (0)