aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Vyukov <dvyukov@google.com>2011-06-22 16:20:37 -0400
committerRuss Cox <rsc@golang.org>2011-06-22 16:20:37 -0400
commit8cab7f570395ba07b732a935fc1c916d28f8b7ef (patch)
tree65b49f133b82e16dde3007e1104cff93ad280577
parent89d334ffe1fe7667505033f4ca49ff50954d9e7e (diff)
downloadgo-8cab7f570395ba07b732a935fc1c916d28f8b7ef.tar.gz
go-8cab7f570395ba07b732a935fc1c916d28f8b7ef.zip
sync: restore GOMAXPROCS during benchmarks
R=golang-dev CC=dvyukov, golang-dev https://golang.org/cl/4631060
-rw-r--r--src/pkg/sync/mutex_test.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pkg/sync/mutex_test.go b/src/pkg/sync/mutex_test.go
index f5c20ca49b..9bfdec365f 100644
--- a/src/pkg/sync/mutex_test.go
+++ b/src/pkg/sync/mutex_test.go
@@ -43,7 +43,7 @@ func BenchmarkContendedSemaphore(b *testing.B) {
s := new(uint32)
*s = 1
c := make(chan bool)
- runtime.GOMAXPROCS(2)
+ defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(2))
b.StartTimer()
go HammerSemaphore(s, b.N/2, c)
@@ -81,7 +81,7 @@ func BenchmarkContendedMutex(b *testing.B) {
b.StopTimer()
m := new(Mutex)
c := make(chan bool)
- runtime.GOMAXPROCS(2)
+ defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(2))
b.StartTimer()
go HammerMutex(m, b.N/2, c)