Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for TestNoRaceMutexSemaphore (0.27 sec)

  1. src/runtime/race/testdata/mutex_test.go

    		mu.Lock()
    		for !written {
    			mu.Unlock()
    			time.Sleep(100 * time.Microsecond)
    			mu.Lock()
    		}
    		mu.Unlock()
    		x = 1
    		ch <- true
    	}()
    	<-ch
    	<-ch
    }
    
    func TestNoRaceMutexSemaphore(t *testing.T) {
    	var mu sync.Mutex
    	ch := make(chan bool, 2)
    	x := 0
    	_ = x
    	mu.Lock()
    	go func() {
    		x = 1
    		mu.Unlock()
    		ch <- true
    	}()
    	go func() {
    		mu.Lock()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Feb 23 22:14:38 UTC 2021
    - 2K bytes
    - Viewed (0)
Back to top