Skip to content

Commit

Permalink
pass by address
Browse files Browse the repository at this point in the history
  • Loading branch information
Derek Collison committed Apr 25, 2014
1 parent 2141cc7 commit cd56514
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func BenchmarkParseSize(b *testing.B) {
}
}

func deferUnlock(mu sync.Mutex) {
func deferUnlock(mu *sync.Mutex) {
mu.Lock()
defer mu.Unlock()
}
Expand All @@ -33,11 +33,11 @@ func BenchmarkDeferMutex(b *testing.B) {
var mu sync.Mutex
b.SetBytes(1)
for i := 0; i < b.N; i++ {
deferUnlock(mu)
deferUnlock(&mu)
}
}

func noDeferUnlock(mu sync.Mutex) {
func noDeferUnlock(mu *sync.Mutex) {
mu.Lock()
mu.Unlock()
}
Expand All @@ -46,6 +46,6 @@ func BenchmarkNoDeferMutex(b *testing.B) {
var mu sync.Mutex
b.SetBytes(1)
for i := 0; i < b.N; i++ {
noDeferUnlock(mu)
noDeferUnlock(&mu)
}
}

0 comments on commit cd56514

Please sign in to comment.