Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for HammerMutex (0.16 sec)

  1. src/sync/mutex_test.go

    	*s = 1
    	c := make(chan bool)
    	defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(2))
    	b.StartTimer()
    
    	go HammerSemaphore(s, b.N/2, c)
    	go HammerSemaphore(s, b.N/2, c)
    	<-c
    	<-c
    }
    
    func HammerMutex(m *Mutex, loops int, cdone chan bool) {
    	for i := 0; i < loops; i++ {
    		if i%3 == 0 {
    			if m.TryLock() {
    				m.Unlock()
    			}
    			continue
    		}
    		m.Lock()
    		m.Unlock()
    	}
    	cdone <- true
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jun 16 21:25:35 UTC 2022
    - 5.9K bytes
    - Viewed (0)
  2. internal/dsync/dsync_test.go

    	defer timer.Stop()
    
    	select {
    	case <-unlockReturned:
    		t.Fatal("Unlock timed out, which should not happen")
    	case <-timer.C:
    	}
    }
    
    // Borrowed from mutex_test.go
    func HammerMutex(m *DRWMutex, loops int, cdone chan bool) {
    	for i := 0; i < loops; i++ {
    		m.Lock(id, source)
    		m.Unlock(context.Background())
    	}
    	cdone <- true
    }
    
    // Borrowed from mutex_test.go
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Sat Dec 24 03:49:07 UTC 2022
    - 11K bytes
    - Viewed (0)
Back to top