Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for TestSemaphore (0.22 sec)

  1. src/sync/mutex_test.go

    	"time"
    )
    
    func HammerSemaphore(s *uint32, loops int, cdone chan bool) {
    	for i := 0; i < loops; i++ {
    		Runtime_Semacquire(s)
    		Runtime_Semrelease(s, false, 0)
    	}
    	cdone <- true
    }
    
    func TestSemaphore(t *testing.T) {
    	s := new(uint32)
    	*s = 1
    	c := make(chan bool)
    	for i := 0; i < 10; i++ {
    		go HammerSemaphore(s, 1000, c)
    	}
    	for i := 0; i < 10; i++ {
    		<-c
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jun 16 21:25:35 UTC 2022
    - 5.9K bytes
    - Viewed (0)
Back to top