github.com/sitano/gsysint@v0.0.0-20190607084937-69a4f3233e4e/mutex_test.go (about)

     1  package gsysint
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/sitano/gsysint/g"
     7  )
     8  
     9  func TestMutex(t *testing.T) {
    10  	l := &g.Mutex{}
    11  	Lock(l)
    12  	Unlock(l)
    13  }
    14  
    15  func BenchmarkMutexUncontended(b *testing.B) {
    16  	l := &g.Mutex{}
    17  	for i := 0; i < b.N; i++ {
    18  		Lock(l)
    19  		Unlock(l)
    20  	}
    21  }