Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for TestNoRaceProducerConsumerUnbuffered (0.2 sec)

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

    	c1 := make(chan int, 10)
    	x := 0
    	go func() {
    		c1 <- x // read of x does not race with...
    		done <- true
    	}()
    	x = <-c1 // ... write to x here
    	<-done
    }
    
    func TestNoRaceProducerConsumerUnbuffered(t *testing.T) {
    	type Task struct {
    		f    func()
    		done chan bool
    	}
    
    	queue := make(chan Task)
    
    	go func() {
    		t := <-queue
    		t.f()
    		t.done <- true
    	}()
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jul 18 19:55:29 UTC 2023
    - 11K bytes
    - Viewed (0)
Back to top