Skip to content

Commit cd56514

Browse files
author
Derek Collison
committed
pass by address
1 parent 2141cc7 commit cd56514

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

server/util_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func BenchmarkParseSize(b *testing.B) {
2424
}
2525
}
2626

27-
func deferUnlock(mu sync.Mutex) {
27+
func deferUnlock(mu *sync.Mutex) {
2828
mu.Lock()
2929
defer mu.Unlock()
3030
}
@@ -33,11 +33,11 @@ func BenchmarkDeferMutex(b *testing.B) {
3333
var mu sync.Mutex
3434
b.SetBytes(1)
3535
for i := 0; i < b.N; i++ {
36-
deferUnlock(mu)
36+
deferUnlock(&mu)
3737
}
3838
}
3939

40-
func noDeferUnlock(mu sync.Mutex) {
40+
func noDeferUnlock(mu *sync.Mutex) {
4141
mu.Lock()
4242
mu.Unlock()
4343
}
@@ -46,6 +46,6 @@ func BenchmarkNoDeferMutex(b *testing.B) {
4646
var mu sync.Mutex
4747
b.SetBytes(1)
4848
for i := 0; i < b.N; i++ {
49-
noDeferUnlock(mu)
49+
noDeferUnlock(&mu)
5050
}
5151
}

0 commit comments

Comments
 (0)