Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for TestOnce (0.12 sec)

  1. 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)
  2. src/cmd/go/internal/modload/load.go

    	inStd       bool
    	altMods     []module.Version // modules that could have contained the package but did not
    
    	// Populated by (*loader).pkgTest:
    	testOnce sync.Once
    	test     *loadPkg
    
    	// Populated by postprocessing in (*loader).buildStacks:
    	stack *loadPkg // package importing this one in minimal import stack for this pkg
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 14:56:56 UTC 2024
    - 84K bytes
    - Viewed (0)
Back to top